Dynamics CRM auto populate lookup values from custom field – Part 2

This is second part of this series. If you are not familiar with the business case, I highly recommend that you read part 1 where I explain the business case and QuickView creation.

Ok, now that we know the background, let’s look at the task at hand.

We have two entities (Account and Registration Info) with a custom unique ID –DBID. When a registration info record is created, we need to find which Account it belongs to, by looking at the DBID custom field value.

Like in all my flows, I will break this down to 3 stages.

  1. When a registration info record is created – Trigger
  2. Find the account that has the same DBID – Get records action
  3. Update the account > Registration Info lookup with the created registration info record ID.

Let’s begin..

  1. Go to flow.microsoft.com
  2. Create a new automated flow and name it appropriately.
  3. Select Common data service > “When a record is created” connector

4. Add the environment, entity and scope. In this, I have selected scope as organization since this should work for any record within the organization.

5. Add “List items” action from Common Data service. Configure it as below:

‘crmd_dbid’ is the field name that contains DBID in the account entity.

This connector uses OData query and will return all the accounts with the specific DBID.

6. Now that we have the account, we can go ahead and update the “Registration Info” lookup of that account so that it will be linked to the new record and show up in the quick view.

7. As the final step, let’s add account update. Add “Update record” action as below:

As soon as you put the “Account” from previous step as the record identifier, the whole action will go inside a for-each loop. This is because the flow is expecting multiple records from the “List records” action.

Now, we can update the Registration Info lookup with the actual record ID.

All set! Let’s test this now..

Create a new “Registration Info” record. (Account field is non mandatory)

Now, registration info is populating as expected.

Earlier, we needed custom code to map two entities based on a foreign key in dynamics. However, with power automate. It is now really easy to map a lookup based on another field.

Due to the nature of business, users might not create all account related entity records within the account record. They might create them separately. They may later request you to link the records. This flow can be modified to map any two entities based on a custom field.

Try experimenting and you will find more useful applications of this flow.

Happy Learning!

Categories: Dynamics 365, Power Automate

Tags: , ,

1 reply


  1. Dynamics CRM auto populate lookup values from custom field – Part 1 – PowerPlatform Solutions

Leave a Reply

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

WordPress.com Logo

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

Facebook photo

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

Connecting to %s

%d bloggers like this: