This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** Apex version of the default logic. | |
* If opportunity's assigned account is assigned to | |
* Case 1: 0 territories in active model | |
* then set territory2Id = null | |
* Case 2: 1 territory in active model | |
* then set territory2Id = account's territory2Id | |
* Case 3: 2 or more territories in active model | |
* then set territory2Id = account's territory2Id that is of highest priority. | |
* But if multiple territories have same highest priority, then set territory2Id = null | |
*/ |