Please wait, loading...

 

UCI : Get Entity Record URL or Generate Dynamic Record URL of a Record in Power automate using CDs connector and Variable

September 12, 2020

We would be using power automated flow to generate a dynamic record URL, we will also check how to get the Current Record URL in power to automate

The Scenario we had is when a case is resolved, send an email to the manager of the record that the Case is resolved including Record URL.

As per the above image, the URL contains 3 parts

  1. URL of Environment: when we talk about the dynamic Record URL it should also consider when we move from UATto production we should not change it in the Production manual it should automatically take the URL of Environment.DVMSKEUAT.CRM.Dynamics.com to DVMSKEPROD.CRM.Dynamics.com
  2. App ID: Each App has it unique Id if you want that Entity to open in a specific App we need to Define it in the URLappid = GUID 
  3. CMD Bar: CRM Bar is the bar where we navigate throw cmd buttons. We can remove/add-in from window by putting cmdbar= false/true

  4. NavBar: This is the Blue bar of CRM where we navigate app and entity history, We can Remove/add in form window by setting navbar=on/off

  5. PageType: it is used to define type of page , Example pagetype=dashboard , pagetype=entitylist , pagetype=entity  E.T.C

  6. ENT: ent stands for Entity where we define the name of entity example account, contact, incident in our case
  7. ID: this defines GUID unique id of the page type or entity we want to retrieve data for example if we  using pagetype= Dashboard it will need GUID of Dahsboard

Check 1: Get Environment in Power automate flow

  • As per the Scenario, we added trigger as an update of the case with a filter as status should be equal to 5 (problem resolved)

  • Now ideally we should get Environment URL in the Dynamic field OdataID as below but that will not come up when the trigger happens from CDS
  • So we will use Action to Get Case using Trigger ID, We know its repeated step but this is needed to get Environment URL, and we can limit attribute retrieving. We are using Compose action to verify our output

  • Here we get the full Odatat URL, not just the Environment URL, so we will be using an Expression uriHosts(outputs(‘URL’)
  • Compose action: uriHosts(outputs(‘URL’) , Where outputs is output of compose and (‘url’) action name refer screenshot
  • Other Action: uriHost(body(‘ActionName’)?[‘@odata.id’]) 

Check 2: Get Appid in power automate

AppId can no be retrieved directly in Power automate.

  1. we use a configuration ” organization config”  where we store multiple appid example sales hub , customer hub etc
  2. We will use get record action to retrieve the required appid.

Check 2: Generate dynamics record URl in power automate and use in Email

In Point 1 we got the environment url and from point 2 we know how to get AppId as well, but here we are not using appid and if we don’t use it that doesn’t it will automatically open it available app as per permission.

  1. We created an Trigger as update of case
  2. Using compose output and get record we got the Odata URL as well
  3. Now we will initialize Variable just to get the final output of the dynamic record URL, we can do this directly in email as well.

  4.  Now we will use Hyperlink or ancher html tag to use Record url in Email

In Output we can see our URL which can be with or withour CMDBAR and NAVBAR

https://i0.wp.com/microsoftdynamics.in/wp-content/uploads/2020/04/Microsoftdynamics365.png?fit=640%2C651&ssl=1
Microsoft Dynamics Community Profile

Learn more