Skip to main content

Notifications

Linking Dynamics 365 Record to Power Automate Flow Run History ID

Introduction

If you're using Power Automate flows to automate processes such as sending notification emails for each newly created contact in D365, you'll end up with a lot of runs. This also means that there will be a significant amount of historical data in the flow run history.

As a result, locating the right flow run ID can become increasingly difficult. This blog post aims to provide a solution by sharing a method on how to link a D365 record to a specific flow run ID. By doing so, you can easily find the correct Power Automate run ID, saving valuable time and enabling more efficient workflow management.

Test Environment:

Dataverse: Dynamics 365 CRM online

Power Automate Flow: An existing flow

6242.pastedimage1684316543561v1.png
Flow Run history URL Format:
Right-click an existing flow run history URL for example:
 
0511.pastedimage1684316667293v2.png
Raw URL:
https://make.powerautomate.com/environments/a6****d-b5c5-4089-a23b-bd80edfac2e5/flows/b***72c6-025d-4c29-9f76-2a8ba4106803/runs/08585172906511072***668963326CU132
Split it into the following 3 parts:
https://make.powerautomate.com/environments/environments/{Environment ID}/flows/{Flow ID}/runs/{Run ID}
Environment ID: a6****d-b5c5-4089-a23b-bd80edfac2e5
Flow ID: b***72c6-025d-4c29-9f76-2a8ba4106803
Run ID: 8585172906511072***668963326CU132
Therefore, if we can get the 3 IDs, then we could build the flow run id.
Expression workflow()
This function: workflow() provides your details for the workflow itself at runtime.
Response of this function:
pastedimage1684318444295v3.png
Generate the URL
So, let's generate the URL through the concat expression:
concat(
'https://make.powerautomate.com/environments/',
workflow()?['tags']['environmentName'],
'/flows/',
workflow()?['name'],
'/runs/',
workflow()?['run']['name']
)
pastedimage1684318867907v4.png
Generated URL
7028.pastedimage1684391143624v1.png
Next, update this flow Run History URL to Dynamics 365.
Create a new column Flow Run History URL in the Contact entity
1, Field Type Single Line Text
2, Set the format to URL
3, Maximum character count: 500 
1108.pastedimage1684391373582v2.png
Update the generated URL to Contact's Flow Run History URL
pastedimage1684391824678v3.png
pastedimage1684391847567v4.png
Run and Test it, then you can find the Flow run History URL was updated to the Contact.
pastedimage1684391962958v5.png
Click the network icon pastedimage1684392097460v6.pngthen open the run history detail page.
pastedimage1684392127883v7.png
Conclusion:
By following these steps, you can easily write the Running History ID to Dynamics 365 within the Power Automate flow. You can easily find the correct Power Automate run ID, saving valuable time
The End.

Comments

*This post is locked for comments