Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Dynamics 365 Power Automate Flow - Field Updates

Posted on by 32

Hello! 

I am new to using Dynamics 365 and Power Automate. This will be my first post so any guidance or help will be much appreciated. 

I created a Cloud Flow in an attempt to alter a record. When a record is updated, this Flow would trigger and transfer the value from a text field to a lookup field (within the same record). This lookup field is tied to another entity through a N:1 relationship. 

When I attempt to run the Flow, I receive an error. From what I can gather this is because the Flow cannot update the lookup field since it is expecting a GUID to be passed (due to the relationship), meanwhile I am providing a string.

I've tried capturing the GUID associated with the string I am passing in. I attempted to make an array made up of all the GUIDS (and various values that accompany them). I then tried to loop the string I want to pass in against this array. Once I have a match. I'd extract the GUID and then pass that instead of the string. Apologies if this sounds confusing, as I am confused myself.

I am unsure if this is the correct approach to my issue. 

Again, any help would be welcomed greatly!

   

  • Verified answer
    Wahaj Rashid Profile Picture
    Wahaj Rashid 11,319 on at
    RE: Dynamics 365 Power Automate Flow - Field Updates

    Hi,

    Glad it helped.

    For the name of the Action, for example, if your action name is List Active Contacts, you can refer this in a formula as 'List_Active_Contacts' (replace the spaces with underscores):

    pastedimage1614893949859v1.png

    pastedimage1614894043536v2.png

    For documentation on expressions (related to CDS), please refer to following:

    Reference guide for functions in expressions - Azure Logic Apps | Microsoft Docs

    You can also join the PowerAutomate community to get help:

    Microsoft Power Automate Community - Power Platform Community

    I am also planning to post some common PowerAutomate - CDS samples, please follow my blog.

  • Dlazowskileja Profile Picture
    Dlazowskileja 32 on at
    RE: Dynamics 365 Power Automate Flow - Field Updates

    Hi again!

    The solution worked! I had to stop the Flow from looping and now its resolved.

    I had two final questions Wahaj.

    1.) Where can I find either documentation or an API on the syntax you used to write first(body('List_Rows')?['value'])?['fab_branch_id']. Is this just how to access JSON data?

    2.) I am unsure where to find the "name" of a workflow action. It was 'List_Rows' as the default name, but where can I see this information?

    Again thank you so much for the help as this has been a huge help for me to learn how to use Power Automate

  • Verified answer
    Wahaj Rashid Profile Picture
    Wahaj Rashid 11,319 on at
    RE: Dynamics 365 Power Automate Flow - Field Updates

    Hi,

    I see the following problems:

    • In the List Record, it's better to list the fields you need.
    • After the List record, you have to use either for each to get the BranchId Value or you have to use an expression to get the value from the first record retrieved.

    Assuming your List Rows action name is 'List_Rows'), following formula should get the first retrieved record's value:

    first(body('List_Rows')?['value'])?['fab_branch_id']
    Here is an example of updating a lookup field:
    pastedimage1614714899160v1.png
  • Dlazowskileja Profile Picture
    Dlazowskileja 32 on at
    RE: Dynamics 365 Power Automate Flow - Field Updates

    Of course!

    Here is the output when I run a test. 

    pastedimage1614695674140v1.pngpastedimage1614697745719v2.png

    Here is how I narrow down the list of records from the Branch entity, using the string I pass in. 

    pastedimage1614699260525v3.png

    The part I am now confused by is how to pass the fab_branchid GUID from my output into the following field within the Update a record action:

    pastedimage1614699490730v4.png

    pastedimage1614699636159v5.png

    BranchUser is the lookup field I am attempting to bind the GUID to. However, I have tried a few ways so far but nothing has worked. From what I have read online, would I need to make a Compose action and then parse through through the JSON data the List record action has output in order to grab the GUID? 

    Thank you so much!

  • Wahaj Rashid Profile Picture
    Wahaj Rashid 11,319 on at
    RE: Dynamics 365 Power Automate Flow - Field Updates

    Hi,

    You are welcome.

    Please share a screenshot and expression you are using to get the value of Branch ID.

  • Dlazowskileja Profile Picture
    Dlazowskileja 32 on at
    RE: Dynamics 365 Power Automate Flow - Field Updates

    Hi Wahaj!

    I appreciate your help so far! I've reduced the logic in my Cloud Flow to align with what you suggested. 

    Currently my logic is: 

    • Tigger when a record is updated
    • Retrieve a List of records from the Branch entity (filtered by the string I am passing in)
    • Update a record 

    I am stuck on how to bind the GUID I've retrieved to the lookup field. I see that the output is correct from my List records action (view below)

    pastedimage1614649931205v1.png

    Would I then type something like /branches/fab_branchid? 

    I also have received the following error: 'Update_a_record': The parameter with value '"/branches/fab_branchid"' in path 'item/_fab_branchuserid_value' with type/format 'String' is not convertible to type/format 'String/uuid'.'.

    I see I am still passing in a string instead of the GUID itself, but I am unsure how to grab the GUID from my output. Do I use the output() function? 

    Thanks again!

  • Suggested answer
    Wahaj Rashid Profile Picture
    Wahaj Rashid 11,319 on at
    RE: Dynamics 365 Power Automate Flow - Field Updates

    Hi

    Thank you for your query

    As per my understanding, your flow should look like this:

    • Trigger on Update.
    • List Record: retrieve records of the other entity (lookup) based on your string.
    • Bind the GUID to the lookup field.

    Please see answers in the following thread, these are similar to your problem:

    https://community.dynamics.com/365/sales/f/dynamics-365-for-sales-forum/417284/contact-and-accounts-with-same-account-number

    Please note, when you assign a GUID to a lookup, you need to use the following pattern:

    • /<entity-name>/GUID (e.g. /accounts/<GUID field value>

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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans