Updating Child Records in a One:Many Relationship in Dynamics 365

A requirement which is often surfaced is the ability to update child records in a one:many relationship in Dynamics 365. Probably the most common scenario is an update to an Account should update the Contacts related to that Account. For our example, we will look at this using the standard Telephone1 field on both Account (Main Phone) and Contact (Business Phone).

The standard behavior for this, assuming you are opening an Account, and creating the Contact from there, is the phone number will be mapped from the Account to the newly created Contact. However, if the Main Phone on the Account is updated, the Business Phone for the Contact(s) is not updated. If this is a scenario you are facing, there is a solution for this!

The solution for this involves the Solution: Dynamics 365 Workflow Tools, available here: https://github.com/demianrasko/Dynamics-365-Workflow-Tools/releases

Once the Solution file is downloaded, and imported into your organization (always take a back-up of your Dynamics 365 instance prior to doing this), setting-up a Process/Workflow for this is very straightforward.

Open the Solution file you would like to include your new Process/Workflow in, expand Processes, and click New. Provide a Process Name, Category (Workflow), and Entity. The Entity should be the parent in your one:many relationship. When working with Account (one) and Contact (many), set Entity to: Account, and then OK.

Image.jpg

Building out the rest of your Process/Workflow, make appropriate selections for Scope, and triggering events under the Start When section. For this example, I am going to leave Record is Created checked, and set Main Phone as a trigger under the Record Fields Change area.

Next is building out the logic in the Process/Workflow. Select Add Step, scroll down and highlight the msdyncrmWorkflowTools (version), and select: Update Child Records. Once selected, click on the Set Properties button. Make the following updates:

Parent Record URL – Set to: Account – Record URL (Dynamic)

Relationship Name – Set to: contact_customer_accounts

Parent Field Name – Set to:  telephone1

Child Field Name to Update: telephone1

Note: The correct settings here will depend upon what entities and relationships you are working with. Make the appropriate adjustments for your own scenarios.

Save and Close when the settings have been established. Make any other updates to your Process/Workflow as you see fit. Activate the Process/Workflow when done.

Now, when we update the Main Phone on Account, the related Contacts will automatically be updated by the newly created Process/Workflow!

Account:

Image.jpg

Contact:

Image.jpg