cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

Switch Cases & Error Handling

I have a switch based on a user's department, based on the department the user will be added to the O365 group. 

 

However I have realised when the user already exsits in the group the flow errors. So i tried to create an error handling "configure on run after" however in the switch case this option is greyed out. "Cannot configure run after on the first action in a scope."

 

Is there any solution how error handling can be prevented in switch cases? There will be up to 34 different departments the switch case will be using

 

As if i dont set this my flow will fail and im trying to prevent that from happening.

 

 

errorhandle.PNG

 

 

4 REPLIES 4
Highlighted
Community Support
Community Support

Re: Switch Cases & Error Handling

Hi @daniellemaree,

 

Do you want to prevent the error message from occurring when the user already exists in the group?

Before adding the user into the group, please add a condition to check whether the user exists or not. If already exists, do nothing. If not, add the user into the group.

I have made the following test.

Add the trigger When a new email arrives.

Add the action Initialize variable. Set Name as Name, Type as Array.

Add Switch cases on Subject.

Within Case1, add action List group members.

Add an Apply to each, select Value from previous action List group members. Value set as dynamic content Mail.

Add a Condition, if variables Name contains From (dynamic content from the trigger), do nothing. If no, add member to group.

The same configuration for other cases.

Images for your reference.

1.PNG2.PNG

Besides, if you want to configure run after within the case, please add a dumb action before the action which you want to configure run after. Such as a Compose action.

Please take a try with it on your side.

 

Best regards,

Mabel

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper III
Helper III

Re: Switch Cases & Error Handling

Hi @v-yamao-msft

 

Can this example be done without the email arrival? 

 

As they will be using a powerapp to submit the request. From there the flow is running based on when an item is submitted into the SP list. 

 

Is it possible to check if a user is in the group first before? Once the item powerapp is submited from the user this will be stored in a SP list. Is it possible  to see if a user is in 0365 group first?

 

 

 

 

 

Highlighted
Community Support
Community Support

Re: Switch Cases & Error Handling

Hi @daniellemaree,

 

Yes, you could change the trigger to others based on your scenario. I assume that the SharePoint trigger When an item is created would be appropriate for your scenario.

It seems that users would submit data from PowerApps to SharePoint. To see if a user in Office 365 Group first, you may need to create another flow with the PowerApps button trigger to check if the submitted user exists in the group or not. If already exists, do nothing, if not, add the item to SharePoint list.

Hope it could be your reference.

 

Best regards,

Mabel

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper III
Helper III

Re: Switch Cases & Error Handling

Hi @v-yamao-msft

 

how do you check if the submitted user exists in the group or not? 

 

thanks 

 

danielle

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (7,698)