Updating Entity Reference Power Automate vs Plugin

Recently I worked on a project where not a single line of code was allowed. It was only configuration project. I had a requirement to create number of custom tasks at run time based on the task template. Since plugin was not allowed, used Power Automate(Flow).

While I started working on power Automate, I had to check the syntax for all small things which are on my finger tips when I write the plugin. Hence thought of posting about such syntaxes. Here are few quick help when we create a power automate instead of plugin.

Updating entity reference field

in Plugin if I am updating the regarding field of the task with the case ID

ActivityEntity.regardingobjectid= new EntityReference("incident", targetIncident.Id);

If we want to do same thing in Power Automate, we need to set it in different way

We need to either enter something like below

incidents(Guid) or /incidents/Guid

Updating Owner field

If we want to update the owner of the entity in plugin, we easily do it as mentioned below

// for Team a owner 
ownerId = teamId!=Guid.Empty?new EntityReference("team", teamId):null;
// for User a owner 
ownerId = userId!=Guid.Empty?new EntityReference("systemuser", userId):null;

Again if I want to do that in Power Automate, I have to follow steps and coding.

On similar lines, we also write teams(Owner(value)) if the owner is of Team type.

Ideally, we should be able to get the Owner(type) from Owner of the current entity and assign that value here as

Somehow I am getting Owner type as blank. Might need to confirm if this is one of limitation of the Current connector. Will update the post once get the more details here.

Till that time happy power automating 🙂 Enjoy new learning!

6 thoughts on “Updating Entity Reference Power Automate vs Plugin

  1. As i understand from the snapshot you have added, looks like you are using your trigger to get the Owner(Type) value. Could be a limitation of the trigger returning blank value. If you get the record from the “Get a Record” CDS connector then you get the Owner(Type) as either a user or team logical name. This is what i observed in a random test.

    Any other insights will be helpful.

    Like

    1. HI Sushant, You are absolutely right. However ideally I should get all the details for that record by default . Surprisingly I am able to see ownertype details in output, but not able to get in the flow logic. that’s sad. You can see details of how to get this in flow using get a record action in my next blog

      Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.