Fixed – change the owner of the Flow or Flow client error returned with the status code “Forbidden” and ConnectionAuthorizationFailed in Power Automate


Recently while trying to change the owner of the workflow we were getting the below error 

Flow client error returned with status code “Forbidden” and details “(“error”:X [“code”: “ConnectionAuthorizationFailed”, “message”: “The caller object id is ‘ffcdd1fc-2858-4019-9a96-19d73ae124c8″. Connection ‘providers/Microsoft.PowerApps/APIs/shared_commondataserviceforapps/connections/shared-commondataser-87229e07-1003-4e05-8172-fdaf112ceb98’ to ‘shared_commondataserviceforapps cannot be used to activate this flow, either because this is not a valid connection or because it is not a connection you have access permission for. Either replace the connection with a valid connection you can access or have the connection owner activate the flow, so the connection is shared with you in the context of this flow.”}}”.

Below are the steps we were following to change the owner of the cloud flow –

https://learn.microsoft.com/en-us/power-automate/change-cloud-flow-owner

Select Edit for the flow, specify the owner and save.


In our case, the owner had left the organization and the user’s record was not available in the CRM. Finally, we managed to change the owner and fix the issue, by assigning the new owner to the corresponding modern flow record through the below steps – 

  • Open Advanced Find
  • Search for Process Type equals Modern Flow


  • Select the flow, click on the Assign Process button and specify the new owner.


This way we were able to change the owner without any error and got the flow working properly.

Hope it helps..

Advertisements

Fixed – Resource not found for the segment in Power Automate


You might get this error while writing a flow –

Fixed – Resource not found for the segment – ‘GUID’

The error was for the below field – Owner (lookup)

To populate a lookup field, we need to specify the plural schema name of the entity /table, followed by the GUID –

Both the option worked –

Hope it helps..

Advertisements

Run as option in When a row is added, modified or deleted trigger – Power Automate


Let us see Run As option of When a row is added, modified or deleted trigger in action, to understand its behavior.

Below is our example flow – it triggers when a field on the case is updated and then it updates the lead record.

Here we have not specified any value for Run as for When a row is added, modified or deleted trigger step.

On updating a case record using the User 1 account who is also the Flow Owner, we can see the modified user as User 1 for the lead record.

Let us trigger the flow this time through User 2.

This time also modified by for the lead record is User 1, even though the Modifying User and Row Owner were different.

So if Runs as is not specified, the Microsoft Dataverse actions are performed using the context of the Flow Owner.

To test it further let us remove the update rights of User 1, who is the flow owner, and trigger the flow again using User 2.

As expected the flow run fails this time.

Principal with id 7252e222-c07f-ec11-8d22-000d3a98d479 does not have WriteAccess right(s) for record with id 8ce6c6de-1bff-e411-80d4-c4346bac4730 of entity lead

Not let us specify Run as = Modifying User this time, and trigger the flow using User 2 again. (we have restored the rights of User 1)

This time also we can see the modified by the user as User 1 (Nishant Rana) the flow owner.

For it to run under the context of the user set as “Run As” in When a row is added, modified or deleted trigger, we need to select the Use invoker’s connection setting for the Update a row step.

Let us trigger the flow again through User 2, remember we have Run As set as modifying user.

Interestingly it still shows User 1 as the Modified By user.

Let us again remove the write rights of User 1 and trigger the flow using User 2.

This time flow is successful. If you remember it failed last time when we removed the User 1 rights and the Run as was default Flow Owner.

And this time, it shows modified by as User 2. (as we can see for user 1, the record is read-only as we have the rights removed)

This time it worked because had set Run As as Modifying User and specified Use invoker’s connection for the subsequent step i.e. update a row in this case, so it used User 2’s context which modified the case record to trigger the flow, which in turn updated the lead record using user 2’s context.

Now it will fail if User 1 updates the case record and triggers the flow because it will try to update the lead record using its context i.e. Run as = modified by

We will observe a similar behavior with Run As = Row Owner.

In case the owner of the record is a team, instead of a user, then it falls back to the flow owner option.

Get all the details here – https://docs.microsoft.com/en-us/power-automate/dataverse/create-update-delete-trigger#user-impersonation-using-run-as

Also check – https://d365demystified.com/2020/10/30/run-as-context-in-cds-current-environment-flow-trigger-power-automate/

Hope it helps..

Advertisements

Fixed – Flow client error returned with status code “Forbidden” and details – MissingAdequateQuotaPolicy, the user does not have a service plan adequate for the non-Standard connection in Power Automate


Recently one of the users reported this error while trying to Test a flow.

Request to XRM API failed with error: ‘Message: Flow client error returned with status code “Forbidden” and details “{“error”:{“code”:”MissingAdequateQuotaPolicy”,”message”:”The user ‘8a47d139-662e-4b73-bca3-53a59e8bebeb’ does not have a service plan adequate for the non-Standard connection ‘Microsoft Dataverse’. https://go.microsoft.com/fwlink/?linkid=2123710″,”extendedData”:{}}}”. Code: 0x80060467 InnerError: ‘.

As here the Premium Dataverse connection was being used, the resolution was to either purchase a Per User plan or Per Flow plan or to enable the trial of Power-Automate per user plan.

After the trial was enabled for the user, the error got resolved.

Hope it helps..

Advertisements

Understanding Change limits option in Do until control – Power Automate


Within Do Until control in Power Automate we have the option of defining the limits i.e. how long the do until will run either based on count or timeout.

By default, the value for count is 60 and Timeout is PT1H which equates to 1 hour i.e. it will either run 60 times or will run for 1 hour which occurs first.

Let us set the count to 5 and test it.

We have also added the delay of 1 minute along with the condition for do until and triggering it on the update of a lead record.

As expected if the condition is not true, after running 5 times it stops successfully.

Now let us change the Timeout to 2 minute and we keep the count as 5.

As expected after 2 minutes (by that time it has looped 2 times with 1 min delay), the flow stops successfully.

The flow will also be successful when the Do until condition is met.

Here we can make use of Current Iteration Index property of Do until to find out the number of times it has looped.

To set the time out format –

https://www.digi.com/resources/documentation/digidocs/90001437-13/reference/r_iso_8601_duration_format.htm

Lastly the Count value can be maximum 5000 – 

countlimit

Also check –

https://nishantrana.me/2022/05/17/fixed-invalid-template-unable-to-process-template-language-expressions-in-action-template-language-expression-cannot-be-evaluated-the-template-action-is-not-defined-in-the-current-scope/

https://nishantrana.me/2022/01/19/how-to-use-do-until-and-delay-in-power-automate/

https://nishantrana.me/2022/05/19/filter-rows-and-trigger-conditions-in-power-automate/

Hope it helps..

Advertisements

Filter rows and Trigger Conditions in Power Automate


Filter rows and Trigger Conditions can be used to specify the condition on which the trigger should fire. This makes sure that we do not exceed flow execution limits.

Power Automate Licensing – Power Platform Requests

Power Automate Limits and Configuration

In the case of our Dataverse trigger “When a row is added, modified or deleted” we can make use of either Filter rows or Trigger Conditions, as we have both options available.

We’d be using Trigger Conditions for those triggers where we do not have additional property to specify the filter condition.

E.g. we want the flow to run only on a specific file in a library or based on the extension of the file as nicely explained here

https://tomriha.com/trigger-power-automate-flow-only-on-specific-file-in-a-library/

https://www.enjoysharepoint.com/trigger-conditions-in-power-automate/

Now out of curiosity, we tried specifying both Filter rows and Trigger conditions to see how it behaves.

Here for the same trigger we have specified Filter Rows as below

address1_city eq ‘Ahmedabad’

And Trigger Conditions as below

@equals(triggerOutputs()?[‘body/companyname’], ‘MS’)

During our test, we observed that the trigger is firing only when both the conditions or expressions, specified in Filter Rows as well as Trigger Conditions are true.

So basically it will only fire for those rows or records having Company as MS and City equal to Ahmedabad.

It will not fire if either of Filter Rows or Trigger Conditions expression evaluate to be false.

Hope it helps..

Advertisements
%d bloggers like this: