Skip to main content

Hi group,

 

We employ enterprise territory management in our org so when a user is deactivated in Salesforce, part of the deactivation process is automatically removing them from any territories they may be assigned to. Even though users can view account records owned by deactivated users as long as they are in the same territory (assignment rules), child records are not visible to them.

 

We have tried to automatically reassign inactive users to their territories immediately after they were deactivated by creating a custom object and creating a temp record to reassign them then deleting the record after reassignment. We tried to accomplish this programmatically but we ran into timing issues.

 

Looking to get thoughts here after brainstorming with colleagues. Can we maybe accomplish this through a custom metadata type and write a trigger referencing the custom metadata type? So, for example, the user is deactivated and auto-removed from their territory, 30 seconds later the trigger kicks in, reads from the custom metadata type, and reassigns the inactive user back to the territory. That's just a high-level overview of what we're looking to do. 

 

Any insight would be greatly appreciated.

5 Antworten
  1. 2. Feb. 2023, 19:45

    It very well could be a timing issue. I do think your original idea would work though. You could try having a flow or trigger fire when a user is deactivated and grab all the User Assignments. It could then store these in a Collection Variable, wait for 30 seconds, and then recreate the assignments accordingly