Flow attaching apply to each inside apply to each

Copper Contributor

Thank you for your assistance in advance.

 

This flow runs when a response is submitted in a MS Form. The form is collecting information for services offered.  The services are contained in a SharePoint List.  The data from the MS Form is copied across to another SharePoint List.

 

There are a lot of options and the flow is told to what to do if different services selected.

I noticed that the flow fails if the services shown below are true.  It actually tries to send the response down the not true path and then fails. 

 

Any geniuses out there who can help with this one please???

 

3 Replies

Hi @Cdstrev,

solution is to use the Filter array action to filter the Services dynamic content to only include the services specified in the If condition, and then iterate over the filtered array using the Apply to each action.

Here is an example flow:

Trigger: When a new response is submitted in Microsoft Forms

Actions:

1. Get form response details
2. Filter array (value: Services, filter condition: equals, value: 9)
3. Apply to each (items: filtered services):
    * Do something with the current service
4. End of flow

Here are some links for reference:

@LeonPavesic 

Thank you for your response. Could you please assist me with where the filter array would go?

 

Hi @Cdstrev,

thanks for your screenshot and your update.

To add a filter array action to your flow in the image you provided, follow these steps:

  1. Click the Add an action button and select Data operations.
  2. Select the Filter array action.
  3. In the Value field, select the Services dynamic content.
  4. In the Filter condition field, select the equals operator and enter the value of the service you want to filter.
  5. Click the Add new item button to add additional filter conditions, if needed.
  6. Click the Save button.

Once you have added the filter array action, you can connect it to the Apply to each action. To do this, click the Select output from previous steps button and select the Filtered services dynamic content.


You can place the filter array action before or after the condition action, but it is generally best to place it before the condition action so that you are only filtering the services that are relevant to the condition.

Here is an example of how to place the filter array action before the condition action:

Trigger: When a new response is submitted in Microsoft Forms

Actions:

1. Filter array (value: Services, filter condition: equals, value: 9)
2. Condition (condition: Service equals 9)
    * Yes: Do something with the service
    * No: Do something else
3. End of flow

This flow will only iterate over the services that match the filter condition (Service equals 9). If the service does not match the filter condition, then the flow will skip the Do something with the service action and go straight to the End of flow action.

Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.


If the post was useful in other ways, please consider giving it Like.


Kindest regards,


Leon Pavesic
(LinkedIn)