web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Complex Flow Using Swi...
Power Automate
Unanswered

Complex Flow Using Switch Actions Failing on Set Var

(0) ShareShare
ReportReport
Posted on by 16

I am building a new Flow to migrate data from a SP list data source (for a Power Apps) to a new Dataverse table based on Shane Young's excellent video: Import SharePoint to Dataverse for Teams with Power Automate 
I am NOT using this for Teams but the same steps from the video apply with regards to the color choice column.
This is a manually triggered Flow and I first initialize ten variables for use later when adding a new row to DV. Then the Flow gets all items from a SP list and adds new rows to a Dataverse table which contains the appropriate column data types.
Within the Apply to Each there are eight (should be ten but this is a work in progress) Switch actions whose purpose is to determine the Dataverse equivalent ID to the SP list choice column selection.  So when a record contains a value from a SP choice column, I set the respective variable to the DV ID equivalent of that selected choice).  All SP list columns for this Flow are choice columns and I will add the easy columns later once the errors have been resolved.    
Here are some images of my Flow for reference:

Overview of Flow Actions:
Flow - Migrate List Data to DV ERR 1.png
The first Switch action works great but it throws an error on the DHC Predictor Score Value (Get Items) action.  
Flow - Migrate List Data to DV ERR 2.png

Here is what the DHC Predictor Score Switch action looks like.  I confirmed these values by hard-coding a choice selection and peeking the code to retrieve the DV ID value. 

Flow - Migrate List Data to DV ERR 3.png

Here are screenshots from the error page.
Flow - Migrate List Data to DV ERR Details 1.pngFlow - Migrate List Data to DV ERR Details 2.pngFlow - Migrate List Data to DV ERR Details 3.pngFlow - Migrate List Data to DV ERR Details 3b.png

Any help is appreciated. 

Categories:
I have the same question (0)
  • MarshallPlexi Profile Picture
    16 on at

    UPDATE: I can replace the Switch actions with Conditional actions and it will work but I'm still interested in how to make this flow work using Switch actions. Can anyone provide some insight? 

  • Verified answer
    v-jefferni Profile Picture
    on at

    Hi @MarshallPlexi ,

     

    Am not sure but this kind of error may cause by datatype of the input parameter. I found a thread with an explanation that seems to make sense:

    https://powerusers.microsoft.com/t5/General-Power-Automate/Switch-Case-not-working-with-setting-variables/td-p/76200

     

    Hope this helps.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • MarshallPlexi Profile Picture
    16 on at

    @v-jefferni  - Thank you for your response!  Ensuring the data types are set to integer was the solution.
    I made two updates to try to resolve this issue.  First, I changed from string to integer when initializing the varDHCPredictorScrore & varDHCCloser variables. 
    Migrate SP List Data to DV (SWITCH)- Initialize 2 Vars INTEGERS.png
    Second, I added two Compose actions to force integer data types for the varDHCPredictorScrore & varDHCCloser variables and the Switch actions use the outputs from the respective Compose actions (code shown below). 
    Migrate SP List Data to DV (SWITCH)- Int-Out.png
    Here is the complete, updated Flow.
    Migrate SP List Data to DV (SWITCH)- FLOW pt 1.pngMigrate SP List Data to DV (SWITCH)- FLOW pt 2.png
    This is an expanded view of the most important actions in more detail.
    Migrate SP List Data to DV (SWITCH)- FLOW pt 2b.png
    Then here is the end of the Flow.
    Migrate SP List Data to DV (SWITCH)- FLOW pt 3.png
    Thanks again!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard