Hello,
Hope you are all well.
i created a list to manage the users of my sharepoint site. I have a workflow to create SP Groups and add users to it and i have another workflow to remove users from the SP Group.
Users are stored in a list in a multi-People field call "Users" and users i want to remove are stored in a multi-people field called "PeopleToBeRemoved". Each item corresponds to a SPGroup and has it's users and it's ...people to be removed.
What i'm trying to do is...if i put one or several users in "PeopleToBeRemoved", they should be removed from the SPGroup (this works) but also be removed from the field "Users".
I manage to make it work when i put one user one by one in field "PeopleToBeRemoved". the flow fires, compares the users "PeopleToBeRemoved" one by one with the users in "Users" one by one. but when i try to remove several users. it removes the first one and updates the "Users" list accordingly...then as of the second one, it removes the second correctly from the SPGroup but doesn't update the "Users" field anymore.
I use variable that i initialise (varUsersArray with the value of Users and varUsersIntermediate that appends the users)
so for each "PeopleToBeremoved" , it compares Users Email and PeopleToBeRemoved Email. if they are different, it populates varUsersIntermediate
Then it assigns varUsersIntermediate to varUsersArray and updates the field "Users" with varUsersArray.... which is reused in the users loop to go through the users.
At the second pass, it seems that it considers Users email always equal to PeopleToBeRemoved email...whatever the values of the users....so it never repopulated varUsersIntermediate and never updates the field "Users" anymore.
could someone, please, be able to help me on this ?
I also tried to do this with a Filter Array action but i didn't manage, i guess, cause when i never have the possibility to get the "output" attribute to put it in my update action , the dynamic values only show me "Current Item"
Voila ! hope someone can help .
Thanks a lot !!
Solved! Go to Solution.
Hi!
It's not you the stupid one here, it's just me, sundays, hungovers and my English 😄
Well, I found out a way to do it, at's extremely complex so I assume there must be a cleaner simpler way to achieve your requirements. But, in the meantime...
My starting point is a 'Get item', not sure if in your case it's a trigger, or even a 'List items', but anyway, the overall design is here:
The logic just before 'Apply to each' is as follows
Now, the tricky part is inside 'Apply to each'. I iterate all over 'PeopleToBeRemoved' array, added an auxiliary 'Compose' action block to reshape the item under evaluation in each iteration, and added a Condition action block just to ensure each person to be removed is already a user
...so the condition checks if item from current iteration is part of the Users array...
Now on the true branch, I added a 'Scope' that should internally deal with the permissions removal from item currently iterated, next I focus on prepare for updating Users related info
Same approach followed to prepare for update PeopleToBeRemoved related info
Last step, update the SP item:
I just did a test with two persons to be removed, it worked like a charm
Please give it a try and let us know your progress
Proud to be a Flownaut!
Hi!
So I understand that when you mention ...'Users are stored in a list in a multi-People field call "Users" and users i want to remove are stored in a multi-people field called "PeopleToBeRemoved"...'
You mena some sort of structure like this one, right?
If my assumption is correct, what's the challenge? Trying to figure out if one or more users added on 'people to be removed' field already exist in 'Users' field? And if so remove each of the users matching from both fields?
Thanx!
Proud to be a Flownaut!
Hi @efialttes ,
yes the screenshot is correct.
well, the way you say it , it seems that you know how to do and i'm a bt stupid cause i can't manage 😄 .. but yes, it's exactly that ! removing the users in PeopleToBeRemoved from both fields.
Thanks 🙂
Hi!
It's not you the stupid one here, it's just me, sundays, hungovers and my English 😄
Well, I found out a way to do it, at's extremely complex so I assume there must be a cleaner simpler way to achieve your requirements. But, in the meantime...
My starting point is a 'Get item', not sure if in your case it's a trigger, or even a 'List items', but anyway, the overall design is here:
The logic just before 'Apply to each' is as follows
Now, the tricky part is inside 'Apply to each'. I iterate all over 'PeopleToBeRemoved' array, added an auxiliary 'Compose' action block to reshape the item under evaluation in each iteration, and added a Condition action block just to ensure each person to be removed is already a user
...so the condition checks if item from current iteration is part of the Users array...
Now on the true branch, I added a 'Scope' that should internally deal with the permissions removal from item currently iterated, next I focus on prepare for updating Users related info
Same approach followed to prepare for update PeopleToBeRemoved related info
Last step, update the SP item:
I just did a test with two persons to be removed, it worked like a charm
Please give it a try and let us know your progress
Proud to be a Flownaut!
Hi @efialttes ,
Thanks a lot for your time spent on this.
yes i guess it's pretty complex. i admit i started working on this yesterday afternoon and am trying to figure out how to make it work. i always seem to close to the solution but there's always a little thing that's not working.
so i recreated what's on your screenshots but it's not working.
For some reason, in the "Select" actions inside the condition i do not have "Claims" in the dynamic values...i only have the possibility to choose "Outputs"....
so the workflow fails at the end cause it tries to put all the attributes of the users into "Users" and "PeopleToBeRemoved" fields (in the update)
hmm...
Hello again , @efialttes ,
Ok , i readapted a few things and now it works !!!
instead of using the claims in the initialisations, i used the email address
Same thing in the compose action
and inside the condition ( i had to remove the Select and readapted this way)
Voila !!!
Thanks a lot for your help
and ... even on a sunday after a hangover...you're still good 😄
Wow, you got the idea fast and your changes make everything look much much better... Thanx for sharing, that's the spirit!
People lile you make this community great!
Proud to be a Flownaut!
User | Count |
---|---|
23 | |
15 | |
14 | |
10 | |
9 |
User | Count |
---|---|
48 | |
29 | |
26 | |
25 | |
22 |