How to construct a Dataverse record’s dynamic URL with Power Automate

This post shows you how to use the ‘uriHost’ feature on a record’s odata.id to dynamically get the record’s environment URL.

Sometimes it can be required/useful to include a URL to a record, for example when creating a task/email that is regarding the parent record but the action is on a child record.

As far as I can tell, a ‘dynamic record URL’ (as we have them in CRM workflows) is not available via Power Automate.

Yet another Microsoft 'feature'.

This means we have to concatenate the URL ourselves. The most important part is to get the environment variable correct, so that the flow can be deployed to other environments. The building blocks are:

1- ‘Get’ the record for which you want to build the URL (you might already have this via the trigger)

2- Extract the environment URL

Using a ‘compose’ action, manipulate the data.id from the target record:

uriHost(body('Get_a_row_by_ID')?['@odata.id'])

3- Concatenate the URL

BLUE – This is the environment URL extracted in the previous step

RED – This is the table in which the record resides

YELLOW – This is the record you want to link to

concat('https://',outputs('Compose_-_uriHost_-_environment_url'),'/main.aspx?pagetype=entityrecord&etn=incident&id=','INSERT GUID HERE')

This is what the output looks like when you run the flow.

Leave a comment