Updating Entity Reference Power Automate vs Plugin- Owner

In my last blog, I was getting OwnerType as blank. With help of Microsoft community, I understood that we won’t get the OwnerType from the triggering event output. Ideally it should have directly provided, but since it is not provided, let us use the other way around.

Our requirement is to check the Owner type of the Case record and set the same for the task

After the triggering event, I am using “Get a record” step in my flow and the OwnerType value from this step’s output as shown in below snippet

Again here is a tricky thing to remember. If I directly get the OwnerType field from its output in my next step’s expression, again it would be blank. (Not sure why it can’t be used from output in the expression of next step- I may get the reason and some way around and post it)

Hence after getting the record, I need to get that value in a variable as shown in below snippet

Once I have this value in a variable, I can then use it in any expression in next step

if(equals(variables('Ownertype'),'team'),'teams','systemusers')

I thought multiple times if I should use the if else condition which comes in steps Condition, however when I just need to replace the string based on the if condition and rest of the actions are exactly same, then I won’t recommend to use Condition and use branching with same steps. Instead we can use If condition in the expression

Once I use this condition, automatically, it would pick up the OwnerType based on the Case Owner and accordingly assign the same Owner to the Task, be it Team or User, does not matter. For examples, below the owner is Team , hence its setting as Team.

Now another example is a Case where Owner is User.

Task is getting created with same Owner

Lets also check the flow how its executed

In the post we have seen how we can get the Owner from one record and update the same in another record. Let us continue our Power Automate learning in my further posts

Till that time, happy power automating 🙂 Enjoy new learning!

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!