Power Automate: “Set Variable” Action fails inside “Switch” Action

Recently, we were working on Power Automate where we were supposed to set a variable for further use based on the value of an option set field in an entity.

We used Switch action and inside Case block we were trying to set the variable as shown below:

While executing the Power Automate, unfortunately, we were getting error: Action ‘Set_Claim_Type_REPW’ failed.

Surprisingly, there was no additional details to the error message for which we spent significant amount of time finding the root cause. We tried to tweak the sequence of Set Variable action and it was working fine. So, we made sure that at least there is nothing wrong with the Set Variable action.

Finding no other way to address this issue, we changed the Switch action to multiple Condition actions which we avoided initially as it’d look messy but ended up accepting that as the workaround.

So, finally our Power Automate looked like the following:

After replacing Switch action by Condition actions, the Set Variable actions and the Power Automate worked fine.

It seems this is a bug in Power Automate for which we were getting error while setting a string variable inside Switch action whereas the same action worked perfectly fine inside Condition actions.

Hope it helps someone in saving time and action accordingly relatively faster !!

3 thoughts on “Power Automate: “Set Variable” Action fails inside “Switch” Action

Leave a comment

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