
Attention, Trailblazers!
We've got a new trail to help admins get their sales teams on the path to managing territories with Enterprise Territory Management. Check it out!

Attention, Trailblazers!
We've got a new trail to help admins get their sales teams on the path to managing territories with Enterprise Territory Management. Check it out!
Now that leads are included in ETM is it possible to build Automation via Apex to auto assign territories to Leads based on assignment rules (similar to what's possible for Opportunities)?
I do have the "re-evaluate Assignment Rules upon save" checkbox defaulted TRUE on page layouts, but is there a way for this to be triggered regardless of where the Account is updated on the Salesforce UI? Most reps are going to be updating the relevant fields inline on the record itself or via reports so it's mind blowing to me if this is not possible.
I'm not a developer but I have tried to write an Apex trigger (it might be terrible, i wrote it with the help of ChatGPT LOL. I had it add a "hello world" to validate that I was firing the Trigger).
trigger triggerAccount_Reevaluate_Assignment_Rules on Account (before update) {
// Create a DMLOptions object with the AssignmentRuleHeader enabled
Database.DMLOptions dmlOptions = new Database.DMLOptions();
dmlOptions.assignmentRuleHeader.useDefaultRule = true;
// Update the account records with the DMLOptions object
for(Account acc : Trigger.new) {
acc.setOptions(dmlOptions);
acc.Description = 'Hello World';
}
}
From Google searches / IdeaExchange it seems this has not been solved by Salesforce but I can't see how that's possible. Can someone help or just put me out of my misery?
hi @Michael Brown thanks! this is actually for ETM for Accounts. i actually am using Flow to do the actual assignment of Account Owner (plus Sales Rep & BDR fields we use), but i need the Territory assignment to re-evaluate for it to work :-/
Just a heads up that in the future you don't need to create multiple posts for the same question.
You can add additional @ mentions in your post to add to multiple groups and also add additional topics.
I have a reporting question involving territories...let's say our ETM hierarchy is 6 levels. If I want to understand all accounts that are assigned (they would be children) under a certain level, how can I do it?
I can't use Accounts with Territories report where Parent Territory equals X because it doesn't go down the hierarchy and grab the Children that are 2 levels below.
Level 1 (Highest level)
Level 2
Level 3 <-- I want to see all "children" where the Label equals Iberia
Level 4
Level 5 (Lowest level, the territory itself where accounts are assigned)
Thank you for your answers! It is now enabled thanks to salesforce support.
How can I build a rollup or automation to populate the Account Owner field based on a role of a user in the 'Users in Assigned Territories' related list? I've taken a look at the ETM v2 ERD but can't find between that and the objects relationship fields on the "UserTerritory2Association" how to relate the user to the account. Is it indirectly associated with the account through another object in the ERD? It's unclear the path to build the referencing between this related list and the Account Owner field on the Account object. Thanks!
I have done this before - it's been a few years. Even with code this is difficult.
"SObject type does not allow triggers: ObjectTerritory2Association"
So you can't trigger on an Account being associated with a Territory. I found that in the Account trigger Before Insert/Before Update context where you could change OwnerId, a newly assigned territory isn't there yet.
What you can do is in the Account trigger handler's After Insert and After Update context, query for the relevant relevant ObjectTerritory2Association records and do something with that information. But you want to update that Account itself, which you can't do from within that After context. So... async Apex for the win?
I called a queueable or future method (I don't recall which) but only when territories had changed. In the Account trigger handler before update context, I queried for and stored the current territories in a static list; In the after context, I queried and compared, then called the async method to change user lookup fields (like owner) on the account.
Alternatively you could just have this run as scheduled Apex that looks over all recent changes to ObjectTerritory2Association and updates Accounts owner/lookup fields accordingly.
🗞️🗞️ [The Trailblazer Tribune] November 25, 2022 🗞️🗞️
Got feedback? We’d love to hear it! Last week to take our survey. Thank you ❤️ to those of you that already completed it.
NEW CONTENT EVERY WEEK. Be sure to read your weekly digest email on Monday mornings to catch our latest newsletter.
👉 Download file 👈 to access links
⭐ FEATURED EVENTS: SALESFORCE DEVS ASK ME ANYTHING &
TABLEAU CRM LEARNING DAYS ⭐
******************************************************************************
Salesforce Developers Ask Me Anything
11/30 @9am PT
Join Salesforce experts @Danielle Larregui, @Antoine Cabot, and @Chris Peterson for the next edition of our Ask Me Anything around Salesforce Automation with Flow and Apex.
CRM Analytics Learning Days
11/30 @8am PT
Join us to understand what you can do with Snowflake in CRM Analytics. You’ll learn the whats and hows of the connectors for snowflake, live dataset, query snowflake data, and sync out functionality.
💜 INNOVATE 💜
***************************************************************************
Localized Winter ‘23 Admin Preview
Listen in your preferred language!
Deutsch | Italiano | Français | Español | Português
Experience Cloud Winter '23 Release Highlights (recording)
Join @* Release Readiness Trailblazers * to follow all the latest announcements about Salesforce releases.
🤝 CONNECT & GIVE BACK 🤝
***************************************************************************
Celebrate and Recognize the Rising Stars of October
Get An Inside Look at How Slack Communicates Online
Nonprofit & Education Mindshare
Friday Shoutout
🎓 LEARN 🎓
***************************************************************************
Browse Upcoming Customer Success Events
How Salesforce Does Efficient Territory Planning
12/2 @ 9am PT | Register
New! MuleSoft Integration Associate Certification
Dive Deep into Mulesoft Composer and HTTP
Three Powerful Formula Functions You Can Use in Flow
Latest User Generated Content
Bypass Salesforce Flow for a Specific User or Profile
Identify if the record is Previous Year To Date record
Last but not least: to our US friends, 🦃 Happy Thanksgiving!
Join the @Communications & Readiness Connect group and check out the latest Answers Newsletter
I am trying to walk through the process of assigning a lead to a territory via the assigned territory related list on the lead and nothing is showing up. I'm following these instructions. I am testing out ETM in a Dev sandbox and have a model in planning status. Does the model need to be active in order for the territory records to be created and accessible from the lead? Currently I'm just seeing empty results.
Yes. it has to be active for it to function. Thanks
If I have a territory such as west coast, and then I break it down by states as child territories , do I add users to the parent and child territory? Or Only to the child territory they are part of?