Territory Assignment Issues (Lead to Account + Contact)

Territory Assignment Issues (Lead to Account + Contact)

1. Lead → Account & Contact Territory Assignment on Conversion

A Lead is automatically assigned one or more territories using a workflow and Lead Assignment Rules. This works as expected, and we are able to assign multiple territories to a Lead automatically.

However, when the Lead is converted into an Account and a Contact using a workflow, the newly created Account (and the corresponding Contact) does not inherit the same territories that were assigned to the Lead.

Request: Please provide the correct and supported custom function to:

- Fetch all territories assigned to the Lead
- Assign those same territories to the Account created during conversion
- Assign the same territories to the corresponding Contact created during conversion

2. Account → Contact Territory Sync When Updated Manually

As a second step, we want all Contacts under an Account to automatically inherit the Account-level territories when territories are assigned to the Account manually.

This works only when a single territory is assigned to the Account. However, as soon as multiple territories are assigned manually to the Account, all territories are removed from the Contacts under that Account.

We attempted to solve this using a workflow-triggered custom function, but it is not working reliably and keeps throwing errors.

Request: If possible, please provide a reliable custom function that performs the following steps:

- Accepts the Account ID as an input parameter
- Fetches the Account record along with all territories assigned to it
- Fetches all Contacts associated with that Account
- Assigns all Account-level territories to each Contact under that Account