Forum Discussion
SharePoint Online - Designer Workflow actions based on security group
I am trying to get a workflow to take different actions based off of a users security group. Is this possible?
4 Replies
WIthout writing a novel - the short answer is yes you could do something but it's not super straightforward. You're going to need to get comfortable with the Call Web Service Action in SharePoint 2013 style workflows.
I've got some posts here:
https://jaredmatfess.wordpress.com/tag/rest/
Basically you're going to want to get the Current User's ID # in the SharePoint Site Collection (not the Account but the ID #) - to see this try accessing this URL: http://sharepoint.com/sites/yoursite/_api/Web/CurrentUser. You should see some XML and in there should be someting like this:
<d:Id m:type="Edm.Int32">9</d:Id>
(Your # will be different)
Once you have the user's ID, you can then call:http://sharepoint.com/sites/javascript/_api/Web/getUserbyId(9)/Groups << replace the 9 with your # and you'll get XML which lists out the different groups. Then you can iterate over all the groups that the person belongs to and have IF statements to check if their a member of x group - and then proceed from there.
Kind of a cool question - I might pull together a working demo and write up a blog post with better examples. Hopefully that's a little bit of helpful inspiration in the meantime.Just to reiterate, you'll need to do the Call Web Service Actions
1. Get the current user's ID number
2. Get the groups that the person is a member of - iterate over those groups and then assign variables like you sort of stubbed out - if group = Human Resources Group, set variable Group = HR or whatever you want..- Deleted
So the results of the json data is only SP groups correct? I don't see any AD group info.
is AD sec group possible?
- Robert WoodsIron Contributor
Thank you for this. I will read over the material you linked to and give it a shot in designer. Will let you know how it goes on Monday!
- Gregory FrickIron ContributorThanks for this excellent response.