Skip to main content

#Territory Management2 debatiendo

Este tópico nos interessa, face termos reginamento de Territorial

Hello! 

 

We are using TerritoryMgmt.OpportunityTerritory2AssignmentFilter in Enterprise Territory Management.

Our implementation works as follows:

  • If Opportunity.AccountId is populated, we use the standard Account relationship to determine the territory.
  • If Opportunity.AccountId is NULL, we use a custom lookup(Account) field called End_User__c.

In our Apex filter implementation, we successfully:

  1. Retrieve the Account referenced by End_User__c.
  2. Determine the associated Territory2Id.
  3. Return the correct OpportunityId -> Territory2Id mapping from the filter.

However, when we run Run Opportunity Filter, the territory is assigned correctly when AccountId is populated, but it is not assigned when AccountId is NULL and the territory mapping is derived from End_User__c.

We have verified through debugging that:

  • The filter executes successfully.
  • The correct Territory2Id is identified.
  • The correct mapping is returned by the Apex filter.

Our question is:

Does OpportunityTerritory2AssignmentFilter and the standard "Run Opportunity Filter" process support assigning territories based on a custom Account lookup field when Opportunity.AccountId is NULL?

If not, is there a documented platform limitation? If it is supported, are there any specific configuration requirements or known considerations that would prevent the territory assignment from being applied?

Any guidance or confirmation from others who have implemented a similar approach would be greatly appreciated. 

 

Thanks 

 

#Territory Management

1 respuesta
  1. 11 sept, 10:57

     

    Hi Ankitha S, 

     

    you've essentially hit the boundary of how the standard filter works: the Run Opportunity Filter process and OpportunityTerritory2AssignmentFilter are anchored on the Opportunity's Account, not on the Opportunity itself. The whole pipeline derives an opportunity's territory from its Account's territory assignments, so when Opportunity.AccountId is null there's no account-territory context for the platform to validate against and it won't persist the assignment - even though your filter runs and returns a correct OpportunityId to Territory2Id mapping. That's exactly why it works when AccountId is populated and silently no-ops when the territory is derived only from your End User lookup, and it isn't a bug in your Apex, it's inherent to the account-anchored design. 

     

    The reliable fix is to stop relying on the standard filter for those accountless opportunities and set the field yourself: Territory2Id is a standard writable lookup on Opportunity, so put your End User to Territory2 logic in an Opportunity before-save trigger (or a record-triggered Flow) and write Territory2Id directly - that bypasses the account-gated filter entirely and is a supported automation point. Keep the standard filter for the AccountId-populated path and let the trigger handle the accountless path. 

     

    If this helps, please mark it as the Best Answer so it helps the next person - thanks!

0/9000

Created Account report, added territory label and territory description column to report, but these columns are showing blank. 

can anyone help?  

 

#Territory Management

3 respuestas
  1. 29 feb 2024, 07:53

    @Isameddine Yousfi Till now, my issue is not resolved. will mark the best answer when the issue is resolved. I didn't gave answer, i just responded to your advise. I still need help. 

0/9000

Hello!

 

I am trying to set up territory management, but I am not able to create a territory layer and can't seem to figure out why. For permissions I do have Manage Data Layers and Manage Territory Layers turned on, but when I go to create a layer I'm not able to select Territory for a layer type. Is there another permission that I need or is it something else in the settings?

 

Thank you!

3 comentarios
0/9000

Hello! Our company uses Enterprise Territory Management. In our Classic account page layouts, "Evaluate this account against territory rules on save" is the default. So, edits to territory assignment attributes trigger the rules to run and the account to be assigned to a new territory.

 

This also works when we hit "Edit" and make changes on the edit screen, but it does not work for inline edits.

 

Any workarounds for this issue? #Territory Management #Lightning Pages

4 respuestas
0/9000

error:

In the 'US East Coast Zip Code' assignment rule, we can't find the expected selection criteria. Select only accounts with a Billing/ZIP/Postal Code that’s 30000 or lower.

 

Acutally I have done all steps in proper manner ,But still challenge is not completed

5 respuestas
0/9000

Hi EA team!

 

Does anyone has worked implementing a security predicate based on territory management?

 

I would like to know if the way to augment security predicate nodes is the same for role hierarchy for example.

 

Thanks in advance!

4 comentarios
  1. 24 ene 2023, 13:53

    Hi @Roman Michalik I am implementing the same Territory management in CRM Analytics for our org. I am unable to understand the logic for Compute Expression "Add Level". You created Level, F1, F2 etc from TerritoryNamePath. How can I verify my Territory levels. In the territory Model I have territory hierarchy as below

    Territory Model(Active) 

         +WW

               +A

                    AX

                    AY

               +B 

                    BX

                    BY

               +C

               +D

               +E 

               +F 

               +G

    Each territory with + has child territories as shown. How can I implement F1,F2... for above territory Model?

     

    Thanks in advance!

0/9000

The client is asking to put validation so only one territory can be assigned to an Account, if there is any territory assigned to any account, then the system should not allow assigning any other territory to this account.

Second validation regarding userTerritory2Association object. Here client asking to put some restrictions so only one user can be assigned to a territory and if we try to assign a second user against a territory, the system should not allow.

 

Any suggestion please I have checked both and there is no solution as such I know  because Salesforce doesn't give control to write any trigger on ObjectTerritory2Association Object. Also for my second ques, I have checked before insert triggers don't work on the UserTerritory2Association object that's why I am unable to put validation there.

 

Need your valuable comments here.

 @Territory Management

2 respuestas
  1. 19 sept 2022, 21:07

    I think you can handle this with the territory filter logic. You will have to be very specific with your territory identifiers. When you break your territories down so that a territory only ever matches one territory filter. Then only ever associate 1 user to the lowest level territory.  

0/9000

#Wisdomwednesday Territory Planning can help you to streamline your territory creation process all from within Salesforce.  Have a look at how and what data to include to start the Territory planning process.

 

Dataset Concepts

 

#Salesforce Maps #Territory Planning #Salesforce Maps Territory Planning #Territory Management #Dataset

0/9000

I am looking to see if someone can explain why Territory Management doesn't change account ownership when you run the assignment rules within a territory? I'm trying to understand the overarching purpose of ETM without being able to reassign ownership within it? Hope that makes sense! Thank you! 

5 respuestas
  1. 21 jun 2022, 16:44

    In my organization, we run a batch program periodically to update the account ownership after the territory is assigned to it based on a specific territory role. 

0/9000

Has anyone successfully implemented ETM with NPSP?  Any pitfalls that we should be aware of?

 

#Territory Management #NPSP #Security

3 respuestas
  1. 22 nov 2021, 16:51

    We had looked briefly at using it for better forecasting it but I got stuck trying when we needed to do Apex coding to set up our territories (which are international and needed to roll up to either continents or other groups.  Maybe if you have a more conventional US-based structure this wouldn't be an issue.   Also, I made this post elsewhere about one of the issues:  "I am testing out ETM in a Sandbox to see if it might meet my nonprofit's forecasting needs. I hope to eventually enable the Filter-Based Opportunity Territory Assignment once I can find someone with some Apex skills to help, but in the meantime, I am trying to manually assign territories by exporting my opportunities to a Google sheet to push uploads back to Salesforce. I tried pulling the presumed territory ID from the webpage link of the territory, but that isn't working. How can I pull a list of the territory IDs so I can mass update the territories on my opportunities?"

0/9000