Posts

Showing posts with the label addError

Salesforce Fact #916 | Adding validation on UserTerritory2Association

Image
Suppose we would like to add validations while adding users to the territory. For example, The user should be active and the user should not be assigned to multiple territories. We can write the logic in an after insert trigger on UserTerritory2Association object. Attached are the sample code snippets.