The execution of template action ‘Switch’ failed: The result of the evaluation of ‘scope’ action expression ‘@triggerBody()?[‘ApprovalStatus’] is not valid.

In this Microsoft Flow tutorial, We will discuss the solution to an error: “The execution of template action ‘Switch’ failed: The result of the evaluation of ‘scope’ action expression ‘@triggerBody()?[‘ApprovalStatus’] is not valid. It is of type ‘Object’ but is expected to be a value of type ‘String, Integer“.

Recently, I was working in Microsoft Flow. As per my requirement, I have one SharePoint Document Library with a Site Column as “Approval Status“. This site column is a choice column.

By using flow, I have to call all the choice values from that “Approval Status” Site column. For that, I have added one “Switch” case. This switch helps to call all the choice values from the site column.

In that Switch case, I have entered the column name as “Approval Status” in the “On” field. While I was running the flow, the below error came as:

The execution of template action ‘Switch’ failed: The result of the evaluation of ‘scope’ action expression ‘@triggerBody()?[‘ApprovalStatus’] is not valid. It is of type ‘Object’ but is expected to be a value of type ‘String, Integer

an unexpected exception encountered when evaluating branching condition.

“The execution of template action ‘Switch’ failed: The result of the evaluation of ‘scope’ action expression ‘@triggerBody()?[‘ApprovalStatus’] is not valid.”:

The only solution of this above error is:

In the Switch case, Instead of “Approval Status” ” you need to enter “Approval Status Value” in the “On” field from the Dynamic content in the Microsoft Flow.

You can follow the screenshot below of how to enter the On value of the switch case using Dynamic content.

See also  Power Automate Get Display Name From Email

Once you add this “Approval Status Value” and again will run the flow, then the Microsoft flow will run successfully.

the execution of template action 'apply_to_each' failed: the result of the evaluation of 'foreach' expression '@triggeroutputs()?['body/resourcedata/responseid']' is of type 'integer'. the result must be a valid array.

I hope this tutorial helps to resolve the error: “The execution of template action ‘Switch’ failed: The result of the evaluation of ‘scope’ action expression ‘@triggerBody()?[‘ApprovalStatus’] is not valid. It is of type ‘Object’ but is expected to be a value of type ‘String, Integer“.

You may like the following tutorials:

  • >