Salesforce Fact #703 | POC on adding a user to multiple territories using screen flow

UserTerritory2Association object keeps track of the user assignment to the territories. Let's have an automation leveraging screen flow to let admins add a user to multiple territories in a single go.

In this example, we have created a screen flow which takes the userid input and also allows the user to select multiple territories(in this case, it is max 5). Then, we are checking whether the user is already part of the territory, if not we are creating UserTerritory2Association records which eventually adds the user to the selected territories.

Note: Since Territory2 object is not supported in UI API, we get an error on selecting the territory but it can be ignored.

Attached are the screenshots.


























Comments

Popular posts from this blog

Salesforce Fact #192 | Call batch apex from flow

Salesforce Fact #457 | Get current user role name in flow