Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

How to update records between two tables in a 1:N using on-demand workflow?

(0) ShareShare
ReportReport
Posted on by 873

Hello everyone,

I have two tables that are linked in a 1:N relationship, a custom table, and a contacts entity. (One gift can be assigned to many contacts)
So in the custom table, I have the lookup field, and in the contacts, I have the sub-grid that will show all the associated gifts for a specific contact.
The workflow will be triggered from a customer journey and I would like to assign a gift for a contact based on a condition.

I have started by creating an on-demand workflow and implemented the below until now:
1. I chose the custom table as the target entity.
7484.Capture.PNG
2. I added a condition that checks for the contacts that have birthdays on a specific date.
CaptureX.PNG
3. I am still struggling with, how to update the Lookup column to assign the gift for the contacts.
For example, Contact A and Contact B should be assigned with Gift A. (Gift A record exist in my custom table)
CaptureY.PNG

Is there anything wrong with my relationship type between the two tables?
I want to keep this process simple as possible to achieve this requirement.
Can please someone provide a sample example on how to perform this update to the contacts to assign the gifts by using Dynamics 365 on-demand workflow?

Any help is highly appreciated.
Thank you!

  • EBMRay Profile Picture
    EBMRay 873 on at
    RE: How to update records between two tables in a 1:N using on-demand workflow?

    Hi ,

    To make sure that I understand what you mentioned:

    1. I add a flag to the contact as (voucher assigned? yes/no field)

    2. When the customer journey begins -> Update the flag to Yes for the targeted contacts.

    3. Trigger a flow when this flag is yes-> reset it to No -> associate the records to the gifts.

    But the problem again, if the on-demand workflow that is linked to the customer journey has finished the process by updating the flag to Yes before Power Automate (that's actually what will happen) some contacts will receive an email without the voucher assigned.

    Please confirm If I understood you correctly.

    Best regards,

    EBMRay

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to update records between two tables in a 1:N using on-demand workflow?

    Hi EBMRay,

    Unfortunately, you can't  link the flow to the customer journey.

    Maybe you can create a custom field in contact as one flag, you can update the flag field in workflow,  then use the modification of the field to trigger the flow.

  • EBMRay Profile Picture
    EBMRay 873 on at
    RE: How to update records between two tables in a 1:N using on-demand workflow?

    Hi  ,

    Thank you for your reply and for providing an example.

    It seems that the relationship between the two tables intended to be used is N:N as you mentioned since many vouchers can be allocated to one contact and at the same time one contact can have many vouchers.

    However, my dilemma is that the dynamic workflow that can be linked to the customer journey only supports 1:N relationship tables.

    My question is that if I use a power automate flow to associate the 2 records created(N:N entities), how can I link the power automate flow to the customer journey? I found that there is no option to link the power automate flow to the customer journey.

    My purpose of linking the flow to the customer journey is to ensure that the vouchers are allocated before the customer journey runs to avoid sending emails to the contact without the vouchers.

    For example, we have a voucher to be sent out to clients on their birthdays. I want the vouchers to be allocated before the customer journey begins.

    Thus, I asked how to trigger a customer journey through power automate that can be found in the below link:

    https://community.dynamics.com/365/f/dynamics-365-general-forum/444945/triggering-a-customer-journey-using-power-automate

    Can you please assist me with my scenario?

    I look forward to your response.

    Best regards,
    EBMRay

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to update records between two tables in a 1:N using on-demand workflow?

    Hi EBMRay,

    Based on your description--One gift can be assigned to many contacts.

    So you need create a 1:N relationship between Gift and Contact entities, which means that one gift has sub-grid for contacts and there is one gift lookup field in the gift record.

    pastedimage1642484725077v1.png

    Then you can update gift lookup field of contacts in the workflow.

    pastedimage1642485871626v2.png

    But you also mentioned--"So in the custom table, I have the lookup field, and in the contacts, I have the sub-grid that will show all the associated gifts for a specific contact.", which means that one gift can be assigned to only one contact but one contacts can have many gifts, it is contradictory to the previous demand.

     Or you want to one gift can be assigned to many contacts and one contact has many gifts at the same time?

    If so, you need create N:N relationship between two entities, and use flow to associate two records.

    https://www.crmcs.co.uk/content/creating-a-flow-to-add-a-many-to-many-relationship.aspx 

    Relate or unrelate rows in Dataverse - Power Automate | Microsoft Docs

    If I misunderstood the question please elaborate the same further.

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,379 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans