Update Dataloader to take advantage of assigning Leads to Territories

You know that feeling you get when something is giving you the worst time and finally you Google it and then see that wow, there’s something coming soon for that, and you wait and you wait and then finally its here and then you try to use it but it doesn’t work? I know it well!

I don’t know about you, but for years I’ve been asking why I couldn’t just apply my logic from Territory Management to Leads. It drives me crazy. It drives me to create workarounds. It drives me to create more technical debt in my org when I really shouldn’t have to. And so in my latest round of updating Territories and then updating Lead Assignment Rules with the same exact logic, I decided to Google again. Like, someone must have come up with something to be able to use Territories on Leads so that I have my Territory Roles and everything just works together like magic. And it turns out, that yes – there is something in the works for that.

In the Winter ’23 Release, you can now assign Territories to Leads. 😲🤯 YOU CAN NOW ASSIGN TERRITORIES TO LEADS. You can only assign them manually at the moment, which I don’t know if its even worth it to do, but I decided it was and I started the process of creating reports with each Territory so that I can export and import via Dataloader to assign a Territory. This also opens up sharing via the Territory Settings, which is great. Now in a Territory, I can set my access for Account, opportunity, Case, and Lead. All you need to do is check the box enable it.

I enabled it and created my data file. I inserted ObjectTerritory2Association records. And then they all failed. Because the ObjectId was of the wrong type. And I was like…. what. And then after being really sad and disappointed for a few minutes, I realized that duh… this feature was available with a different api version and I probably needed to update my Dataloader. So I did. And then I tried to do my insert again. And then IT WORKED. 🥳

So, how should you setup your file for Dataloader?

Well, all you need is 3 columns.

You need your Lead Id, Your Territory Id, and your Association Cause, which will be Territory2Manual.

The object you want to insert is Object Territory Association.

And there you have it! I’m super excited about the next release, where hopefully actual rules can be created for Leads within the Territory Model itself. Or if not in the next release, whenever it comes. I know this will make a lot of lives a lot easier, and more organized!

0 comments on “Update Dataloader to take advantage of assigning Leads to Territories

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: