I have a flow that's retrieving the values from an MS Form and then pushing them to a SharePoint Online list, and it's running without errors:
The problem is that I have 10 different "Description" fields in my form (the user should only complete one, based on the category they've selected), but only want a single "Description" column in my SharePoint list. When I write the data to the SharePoint list, though, that field is NULL.
To insert the correct Form field into the list, I've created a variable (string) and used a Switch Case to identify and use the correct Description field from the Form, based on the Category field in the Form. I thought this would be a better choice in terms of maintenance than leaving someone to comb through a 10-layer deep nested IF statement.
I'm running the Flow with data using the "School or office supplies, like stationery" category. The corresponding description field is populated from the Form (in the Get Response Details section of the Flow):
It's a relatively small value (maybe 100 characters). So, before the Switch control I initialize a variable to hold the "3,000 binders..." text:
I then have a Switch that will choose a case based on the Category value. It is showing the correct category:
And it is choosing the correct Case. The problem is, when I try to Set Variable within the case, no values are coming through.
This is how I have the Set Variable control configured:
This is the statement for the value field.
The ID matches up to the one shown above, with the description field that I want to use. I'm using this expression instead of selecting the dynamic content field directly because I have 10 fields that all say "Donation Description" in Forms, and it was easier just to code it than to try to figure out which one I needed in the Dynamic Content wizard in Flow. Elsewhere, though, they work the same way (picking the dynamic content item or writing an expression defining it), so I'm assuming they do here, too.
- I'm getting the field that I need from the Forms data
- I'm setting up a string variable to hold it
- I'm using a switch case to select which Forms field should populate the variable
- The switch is selecting the correct case
- The set variable action isn't retrieving or populate the data into the variable
I haven't worked much with variables (and not at all with the switch/case control) but I'm trying to get away from stuffing everything into conditional statements to make it more transparent. Any idea where I'm going wrong in setting my variable?