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
SunnyalexSunnyalex 

@Requirement@

Hello everyone,
i have got one requirement please help me in solving this requirement.
When an Account’s BillingPostalCode (Zip Code), is changed,
Change the Account Owner to the sales representative assigned to the new zip code
Change the Owner field of all the Account’s Contacts to the same sales rep 
Change the Owner field of all the Account’s Open Opportunities to the same sales rep.

1:The logic should run only when the Account’s zip code is changed or populated for the first time
2:If no matching Territories are found, do nothing



Thanks and Regards
Raj Sourav 
Andrew GAndrew G
You will need to create some sort of object to hold the connection between Zip Code and Sales Rep (say ZipAssignment).
Then you will need to create either a flow or trigger, on change of the Zip Code, look for the ZipAssignment record with the matching Zip and populate the field if found.

As an aside, you will (may) also need to write some sort of trigger on the ZipAssignment Object for when the Sales Rep is changed on that record.  Unless you would be happy to do that manual via Dataloader or similar.

Regards
Andrew