top of page
Search
Writer's pictureSebastian Gedge

Dynamic Record Links

Updated: Nov 29, 2022

Recently, i had a requirement to send record links via Power Automate via email.


looking within power automate there was no native way to generate a user friendly clickable link from the triggering event.


My search results didn't bring a complete solution to the problem so here is what i did to create a user friendly clickable link.

1. After the triggering event add a list records action, here we will list the MDA we want to retrieve.

a. In the select columns we need to add "appmoduleid" and "uniquename" columns.

b. Filter rows should contain the name of the MDA you want to get in this instance sales hub, (uniquename eq 'msdynce_saleshub')

c. finally set the row count 1.


2. Next we need to get the detail of the retrieved record to do this we without adding a for each record returned we need to wrap the body in a first() expression with a compose actions

first(outputs('List_MDA_Records_')?['body/value'])


3. Next add a Parse JSON action so we can access the "appmoduleid" as dynamics content.

Example JSON:

{
    "type": "object",
    "properties": {
        "appmoduleid": {
            "type": "string"
        }
    }
}

4. next initialise a string variable this will contain the first part of the dynamics link from the URL.

and will be "/main.aspx?appid="


5. initialise a second string variable in this we will add the text that follows the app id

and will look something like this "&pagetype=entityrecord&etn=formus_currencypot&id="

we could also dynamically set the entity in the etn="" if needed,


6. Add a get record action it doesn't appear possible to get to the odata.id from the trigger event so we must retrieve it. Once we have the target record we can add a Parse JSON action and pass in the record body.


Example JSON:

{
    "type": "object",
    "properties": {
        "@@odata.id": {
            "type": "string"
        }
    }
}

7. Now we need to create the link from all of the above components by concatenating them together

Below is a snippet of what i used to create the link.

concat(uriHost(body('Get_Environment_Address')?['@odata.id']),variables('Partial Link A'),body('Get_App_ID')?['appmoduleid']
,variables('Partial Link B'),outputs('Get_Training_Record')?['body/body/formus_currencypotid'])
  • Next add the first string variable,

  • The the App ID from the fist Pars JSON action

  • Then Add the second String variable

  • Finally add the Unique record Id from the Get Record Action

This outputs a URL that can be used but isn't very user friendly.


So wo make it a little easier on the eyes we can add another compose action and wrap this URL in some HTML to make it look nice.


Example

 Click <a href="@{outputs('Create_Record_Link')}">Here</a> to view it.</div>

once complete it can be added to a email message and sent.


97 views0 comments

Comentarios


Post: Blog2_Post
bottom of page