
Announcements
I am trying to write a flow that adds a user to multiple groups and verifies the user is not already in the group before executing the Add member to group action.
I have two SharePoint lists:
In addition to Get Items, the flow also has the List Group Members action which retrieves the group members based on the output of the Get Items action. I am now trying to write a condition that checks if the user on List 1 is already in the group members list, and this is where I need help. The condition I have tried is using the value from the List group members action, does not contain the user's email. Even though the user is in a group that I am using for the test, the condition comes back as true. I have also tried body from the List group members action, and it did not work. If I select any other dynamic content from the List group members action, it converts to an Apply to each which causes the condition to be true multiple times.
How can I write the condition or update the flow to check if the user is already in a group?
I solved this issue on my own and learned something in the process. The "value" from the List group members action is formatted as JSON. Even though I can look at the JSON output and read what's in it, the condition does not seem to be able to do that. So, I had to use an expression that converts the JSON to string. Once I did this, the condition was able to determine if the user's email address was already in the value output.
This is the expression I used:
string(outputs('List_group_members')?['body/value'])