0

I have a flow that takes the output of a Forms response and pushes it into a SharePoint online list. It's working well for the most part, but I have a multi-select question in my form and corresponding column in SharePoint that is erroring out. I have branching in my form, and so this question won't always have a response.

In my select block I get this error: BadRequest. The 'from' property value in the 'select' action inputs is of type 'Null'. The value must be an array.

The error details are: The 'from' property value in the 'select' action inputs is of type 'Null'. The value must be an array.

failed flow

My select block looks like this:

select block

The From value is referring to the relevant field in my form, with the json tag so it's not treated as a string:

json(outputs('Get_response_details')?['body/r44b6acfc7db144ceb6b572dc74494bca'])

I've tried with the mapping to just use item() but got the error, so I thought I could convince it to use an empty array entry if the field was null, like this:

if(equals(outputs('Get_response_details')?['body/r44b6acfc7db144ceb6b572dc74494bca'], null), json('[]'), json(outputs('Get_response_details')?['body/r44b6acfc7db144ceb6b572dc74494bca']))

That didn't help - I get the same error. I saw another post about this, with this example:

code example

Is my problem that this expression isn't an array, even with the json() wrapper?

outputs('Get_response_details')?['body/r44b6acfc7db144ceb6b572dc74494bca']

Note that the variable is unrelated to this - it's for a different field that's working as expected, and I'm trying not to use a variable to this item.

The flow works correctly when that multi-select field in the form has one or more values in it, but fails whenever it is skipped due to branching. How can I adjust my Select block (or something else in my flow) to accommodate for a null value?

2
  • 1
    try using: if(empty(outputs('Get_response_details')?['body/r44b6acfc7db144ceb6b572dc74494bca']), json('[]'), json(outputs('Get_response_details')?['body/r44b6acfc7db144ceb6b572dc74494bca'])) Commented Jan 11, 2022 at 5:32
  • Thanks - tried that, but the result is the same. The inputs from the select block show {"from": null}. I don't know if the first field in my "map" section is correct... I have "Value" because that was what was in the example I saw, but should that be tied to a field in my form or list or a variable instead? The flow works when I do have one or more values in my Form for the multi-select choice field... it only fails if that question in the Form is skipped due to branching.
    – Darryl
    Commented Jan 11, 2022 at 17:00

1 Answer 1

0

I was able to get it working by handling the condition outside of the select block. Here's what my final flow looks like:

working flow

My condition just references the Form multi-select field and compares it to... nothing. I had tried a conditional block earlier, but testing if it was equal to null and then to an empty string ('' or "") which didn't work. Just leaving the right-hand "choose a value" field blank gave me the result I was looking for.

So if the condition is met (the multi-select field from my Form is null), the flow moves right past my Select block to retrieving some background data from another SP list and then creating the item in my main list. If the condition is not met (the multi-select field in my form in populated), then the Select block builds the array. Since I no longer have to try to incorporate the conditions within my Select, I am able to simplify that as well.

select block

The From value simply calls the relevant Form field and wraps it in json() so it's not treated as text:

json(outputs('Get_response_details')?['body/r44b6acfc7db144ceb6b572dc74494bca'])

The Item value just has a placeholder to build the array:

item()

In my Create Item block I want to populate the ImpactedGrades column in my SharePoint list if there are values to go into it from the Form, so I have another conditional statement at that level:

if(empty(outputs('Get_response_details')?['body/r44b6acfc7db144ceb6b572dc74494bca']),null,body('Select_2'))

create item

This successfully populates my SharePoint column with multi-select choice values if the user provided those in the Form, and leaves that column blank if they did not.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.