Hidden properties in Power Automate - Setting Lookups and Relating Rows
I was building some complex flows the other day and I was looking to simplify it the best I could. I started looking at outputs from previous steps and realised some of the data I needed was actually in the previous steps but not available natively in the dynamic content. This brings me back to the concept that people should learn Power Automate and JSON, as sometimes it can make your flows a lot simpler.
There's two properties I came across recently that I thought were really helpful.
@odata.editLink
@odata.id
With lookups in Power Automate, you need to provide the Entity Set Name, this is not the same as the schema name or plural name. You can easily get the Entity Set Name by navigating to the Table in the solution designer, clicking the tools button and you can copy the Entity Set Name from a clickable link here.
Then whichever lookup you want to populate, you add the Entity Set Name and then open parentheses and insert the ID of the record and then close parentheses.
Now while this isn't a terrible thing to do and hardcoding a value that never changes doesn't mean you flow is less scalable, I like automation and why click multiple times when you can click once 🤷
Instead of using this, I found that if the record I wanted to set the lookup on is in the flow someone from either a "Get Record" or "Add Record" or even a "List Records", I can use the @odata.editLink and it provides me the full URL I need for the lookup, which is great.
The property is not available via dynamic content, so instead you need to write this formula yourself. This is why it's important to understand how to write formulas and how they work to really get the power out of Power Automate. In this instance, I use the formula window, select dynamic content, search for the OData Id, then re-write the formula like the below to change it from @odata.id to @odata.editLink
Later on while I was building, I needed to relate some rows together. In Dataverse, to do this, you use the "Relate Record" action, buy you need the full path of the URL to do this. This is available in the dynamic content but it's not got a descriptive name 😅 It's called @odata.id
Use of this property with the UriHost() function is also pretty useful as it will give you just the URL of Dynamics/Dataverse environment without all the /api/data... url section.
It's sometimes a good idea to go JSON waterfalls 🤣
Ciao for now
MCJ
Thanks Matt, this is the good stuff! It is so many ways to do the same thing and it's so satisfying to find this hidden gems (although they certainly shouldn't have been hidden in the first place). Love your blog, so keep it comming =)