In this Power Automate tutorial, let’s discuss how to solve the error generated in one of my flows: The execution of template action ‘Switch’ failed: The result of the evaluation of ‘scope’ action expression ‘@item()?[‘TaskPriority’]’ is not valid. It is of type ‘Object’ but is expected to be a value of type ‘String, Integer’.
Recently, I was working on the example of a Switch case in Power Automate.
The execution of template action ‘Switch’ failed:The result of the evaluation of ‘scope’ action expression ‘@item()?[‘TaskPriority’]’ is not valid. It is of type ‘Object’ but is expected to be a value of type ‘String, Integer’.
I have a SharePoint list [Task List] with a few columns along with a Task Priority column.
Switch case conditions:
- If the SharePoint list item is added or modified with Task Priority as Low -> Post details of the task in the teams chat of the Assigned person.
- If the list item has a medium Task Priority, email the assigned person about the Task details.
- If the Task Priority value is High -> Create a Meeting with Assigned person and Manager.
The complete flow will be like as shown in the below image:
In that Switch case, I have taken the column name as “Task Priority” in the “On” field. While I was running the flow, the below error came as:
Solution:
The solution for this error will be:
In the Switch case flow action, we need to impose a switch on the SharePoint list column value [Task Priority Value], as it is a choice column instead of a list column [Task Priority].
- Refer to the screenshot below of how to take a value of the switch case using dynamic content.
After taking the Task Priority Value from the dynamic content on the Switch input value, save and run the flow again.
Now, you can check that the flow will run successfully.
This is how I solved the error that was generated in the Power Automate flow.
Conclusion
I hope from this tutorial, you can have an idea of how to resolve the error type like:
The execution of template action ‘Switch’ failed: The result of the evaluation of the ‘scope’ action expression ‘@item()?[‘TaskPriority’]’ is not valid. It is of type ‘Null’ but is expected to be a value of type ‘String, Integer’.
You may also like:
- Power Automate which exceeds the maximum nesting limit of ‘8’
- Power Automate Multiple Conditions
- Power Automate dynamic content
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com
Thank you! This resolved my issue.
Thank you – I spent hours looking into this issue and you provided the solution.