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.
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.
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.
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?
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.
We are excited to announce the launch of Power Virtual Agents Community. Check it out now!
We've updated and improved the layout and uploading format of the Power Automate Cookbook!
Fill out a quick form to claim your user group badge now!