Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

I need to use a workflow to update records with a N:1 relationship to Contact

Posted on by 777

We a Status field on Contact form that is a simple option set, "Happy or Upset" 

We also have a "Car" entity with a lookup field for Contacts, and we create a record for each type car that each Contact has, so that each Contact has multiple "Car" records associated with it. The car records also have the "Happy or Upset" field on them, and whenever the field changes on the Contact form, we want these records updated.

Is it possible to use a workflow to automate this? Right now, each time the field is changed on the Contact, we use an on demand workflow to update all the Car records for that client - however this is getting tedious and not all users remember. How can we automate this, so that each time the field on the Contact form changes, all the related Car records get updated as well? 

*This post is locked for comments

  • Verified answer
    Kokulan Profile Picture
    Kokulan 18,048 on at
    RE: I need to use a workflow to update records with a N:1 relationship to Contact

    Plugin or Workflow based approach would be my first choice over Flow.

    Flow is not native to CRM yet, and it runs outside of Dynamics CRM Servers, it runs on Azure infrastructure that's used by O365 Flows or Azure Logic Apps. Microsoft is working on hosting the Flow engine directly on Dynamics 365 servers but this is at an experimental stage now as far as I know. Since flow runs outside of CRM servers, performance wise this is not the best option. And in my experience with Flows, I noticed it takes a bit longer to trigger than native CRM workflows and occasionally it might even take a few minutes to trigger.  Above all, you have to have license and quota to run flow as you only get so much free quota depending on your subscriptions. So Flow will be my last resort, not the first choice.

    If the Contact will have quite a few Car records linked, and if updating Contact happens on a daily basis, I would go for the workflow (background) based approach as it will not hold-up the UI and the update will happen in the background. But one negative of this approach is that if the Contact has subgrid with Car records and if any of the columns in the view is being updated by background workflow, the user will have to navigate aware from the page or do a full refresh of the page to see the update. The background workflow takes about anywhere between few seconds to 15 seconds normally trigger and complete.

    If the Contact will only have few Car records linked and the if the contact update does not happen frequently, you could do this in plugin as it's only executing a simple logic on a small set of record and it should not affect the user experience much.

  • naZir Profile Picture
    naZir 850 on at
    RE: I need to use a workflow to update records with a N:1 relationship to Contact

    Performance basis you can go with the Flow as it triggered outside of CRM web, but Using flow for every user is bit costly.

  • Ben T Profile Picture
    Ben T 777 on at
    RE: I need to use a workflow to update records with a N:1 relationship to Contact

    Thanks for such a detailed response. Extremely helpful. I am tempted to use Flow, as it seems the simplest approach for a newbie coder. However, I'm concerned about the performance. In the end, whatever keeps the system running as quickly and smoothly as possible is best. Do you have any thoughts about which is best?

  • Verified answer
    Kokulan Profile Picture
    Kokulan 18,048 on at
    RE: I need to use a workflow to update records with a N:1 relationship to Contact

    Hi Ben

    You won't be able to update child records of Contact using Out of the box features or capabilities of the workflow (be it real-time or background). The workflow does not support looping through a list of records and performing any updates on them.

    I think you have the following options.

    01. You could create a Flow using Dynamics 365 Connector. This flow could trigger On Update of Contact and loop through all the Car records associated with the Contact and update them. Have a look at the link below to see how you can update records in CRM using Flow

    community.dynamics.com/.../update-existing-records-in-dynamics-365-crm-using-microsoft-flow

    02.  You could create a Custom Workflow Activity (CWA)  that takes the Contact changed as the input parameter and updates all the car records associated with it. You can then call this CWA in a workflow that triggers on Contact change and pass the contact to CWA and it will take care of the rest.

    03.  You could create a plugin that triggers On Update of the Contact. In the plugin, you could retrieve all associated Car records, loop through them and update them with new values.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans