function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Siddhartha Tomar 12Siddhartha Tomar 12 

Territory Management

Hi All,

I have requirement where i have to assign the lead on the basis of Zip code to particular user (District head). And i have more then 1000 Zip code.

Please suggest what will be best apporach to this.

Thanks
Sid
.
ShirishaShirisha (Salesforce Developers) 
Hi Siddhartha,

Greetings!

You would need to use Batch apex to achiev this requirement.Please refer the sample batch class to update field:

https://www.forcetalks.com/salesforce-topic/writing-a-batch-apex-to-update-field/

Please mark it as best answer if it helps you to fix the issue.

Thank you!

Regards,
Shirisha Pathuri
Siddhartha Tomar 12Siddhartha Tomar 12
Hi Shirisha,

Thanks for reply. I have a requirement when lead is created in salesforce it will assign to particular user based on Zip code. In this case batch class will not work. I don't want to run the batch class to update lead information.

Thanks
Sid
Zen Newman 7Zen Newman 7
Hi Siddhartha- I'm late to the party on this one if you're still looking for a solution though, I've run into similar situations with assigning leads based on countries. The approach I ended up taking was to use a custom object to capture the country(zip codes in this case). You can then use a flow or trigger to query for the zip code record that matches the information on the lead.