Use Power Automate to Assign Records Based on Territory Manager

If you’ve ever assigned a new manager to Sales Territories in Dynamics 365, you know there’s no easy way to reassign all the associated records with that territory. That was the case before, but not anymore! Now with Power Automate, we can trigger a flow on the update of the Territory Manager field and reassign all the leads, accounts, and other records associated with territory easily.

The same would apply in the case of contacts and opportunities along with other activities associated with the account. The assign operation will cascade down to those records since the account entity has a parental relationship with contacts and opportunities.

If you do not want the assign operation to cascade down, you can edit the relationship properties.   To update independent records that are not related to an account, the following method can be used:

Walkthrough: Use Power Automate to assign records

Let’s break down the steps.

  1. First, we need to trigger a flow whenever the manager field updates on the Territory record.
  2. Then we need to get all the associated Leads and Account records.
  3. Next, we need to iterate over them and update the owner.

We’ll use the recommended Common Data Service (current environment) connector instead of the other 2; Common Data Service or Dynamics 365. Common Data Service and Dynamics 365 are limited in what actions they can perform and have limited configuration options.

We’ll set the trigger condition to “Update” action, entity name as “Territory”, and we’ll set the scope to “Organization”. We’ll also filter on the “managerid” field as we don’t want to trigger the flow on any other updates to the territory record.

Use Power Automate to assign records


To get associated Leads and Accounts, we’ll use the OData filter and only select open and active records. We don’t want to update any qualified or disqualified leads or inactive account records.

use the OData filter


We’ll use apply to each component and iterate over each record. We will use the Update action to set the “OwnerId” to the new “Manager” field value.

Update action to set the

We can utilize the parallel branching in Power Automate to speed up the operation by updating Leads, Accounts, and any other entities in parallel.


That’s all there’s to it. With a low-code/no-code approach, we were able to quickly put together a use case, whereas previously, it would have required a custom .NET workflow.

We hope that this blog brought clarity to your Power Automate endeavors. Try it out and let us know your thoughts in the comments section below.

Happy Assigning!