How to automatically link a Contact to its Account in Dynamics 365 Sales
Learn how to build a Power Automate flow that links a Contact pushed from Firmable to the correct Account in Dynamics 365 Sales.
Why you need this
By default, when Firmable pushes a person record to Dynamics 365 Sales, the Contact isn't automatically linked to the relevant Account. This requires a Power Automate flow to handle the linking, Dynamics' native push doesn't do this on its own.
Flow overview
- Trigger: When a row is added, modified or deleted
- List rows: look up Accounts matching the Contact's company domain
- Condition: check whether a matching Account was found
- If found: update the Contact to link it to that Account
- If not found: create a new Account, then link the Contact to it
A note on which field to match on
Website domain is the recommended match field for this flow. The same List rows and Condition logic works with other unique identifiers too, such as a company LinkedIn URL or ABN, if that suits your data better. To swap it, change the Filter rows expression in Step 2 to reference whichever field you're matching on instead of websiteurl, the rest of the flow doesn't need to change.
How to build it
Step 1: Trigger
- Trigger: When a row is added, modified or deleted
- Change type: Added
- Table name: Contacts
- Scope: Organization
Step 2: List rows
- Table name: Accounts
- Filter rows: websiteurl eq [Website], using the Website value from the triggering Contact record
Step 3: Condition
- Expression: length(body('List_rows')?['value']) is greater than 0
- True: a matching Account was found
- False: no matching Account exists yet
Step 4: True branch, update the Contact
- Update a row, Table name: Contacts, Row ID: the triggering Contact
- Set Company Name (Accounts) to the matched Account from the List rows step
Step 5: False branch, create the Account then link it
- Add a new row, Table name: Accounts
- Set Firmable_ID to the Contact's company/account number field pushed from Firmable
- Update a row, Table name: Contacts, Row ID: the triggering Contact
- Set Company Name (Accounts) to the newly created Account
Note on the reference build
The false branch in the original build wraps the Add a new row and Update a row steps inside a For each container. Since the list being checked at that point is the same empty result from the List rows step, it's unclear whether the For each is functionally necessary here or a leftover from an earlier version of the flow. Worth testing without it before reusing this template, rather than assuming it's required.
Prerequisites
- A Firmable_ID (or equivalent) custom field exists on the Accounts table, populated from the Contact's pushed company reference
- The Contact record carries a Website value from Firmable's push, used to match against the Account's websiteurl
Frequently asked questions
What if the Contact's company already exists as an Account but with a slightly different domain? This flow matches on exact websiteurl, a near-duplicate domain (subsidiary, regional site, redirect) won't match and will create a new Account instead. See our guide on avoiding duplicate accounts from domain matching before relying on this in bulk.
Does this run on updates to existing Contacts too? As configured, the Change type is set to Added only, it won't re-run this logic if an existing Contact is later modified.
We hope this article has helped you set up automatic Contact-to-Account linking in Dynamics 365 Sales. If you have any other questions, don't hesitate to contact us at support@firmable.com.