1

I want to start workflow,if item is updated by user who is member of specific group in SharePoint.

Suppose my SharePoint user group is "Test", if any member of this group edits my list item, it should trigger Approval workflow.

My workflow is working if I set hardcoded any user's name.But If I set Group Name, its not performing this step and my workflow is getting stopped.I have created SharePoint 2010 workflow.

ScreenShot: enter image description here

4
  • What error you get when your workflow get stopped? Commented Oct 11, 2018 at 17:44
  • I am not getting any error. but that conditions is not becoming true as may be it is not able to find given Group. Commented Oct 12, 2018 at 5:27
  • Share the screenshot of your workflow where it's not working with the group. Commented Oct 12, 2018 at 5:29
  • @SohailShaikh I have added the sceenshot Commented Oct 12, 2018 at 6:45

2 Answers 2

1

Note: This answer only works for 2013 workflows!

It will not work when inserting the group as the group is en entity in itself. In plain words, a group is just another user to the workflow.

I would utilise the REST API and check if a user is a member of the selected group. I don't tihnk there's a specific endpoint for it, but you can hit the group and ask it to return the user, if it can't return the user. The user isn't a part of the group.

The endpoint to do it is this (Run as a GET request):

/_api/web/sitegroups([Group principal Id])/users/getbyid([User principal id))

The principal id of the group can be found in the url when you open the group. The principal id of the user can be returned from the url when you hover the user.

Both id's can be returned from a people field by selected ID rather than Nlogin name.

2
  • Thank you for this. This might help.I will definitely try this. Please let me know how to use rest call in 2010 Workflow If you have idea. Commented Oct 12, 2018 at 6:34
  • Oh sorry I didn't realise you where using 2010 workflow. Calling webservice is only possible in 2013 workflows
    – Morten K
    Commented Oct 12, 2018 at 6:35
0

You could create a workflow variable of type string for the members of the group and if that variable contains the modified by (also converted to string) it should work.

5
  • Out of curiosity how do you extract the user from the group?
    – Morten K
    Commented Oct 12, 2018 at 6:26
  • According to you then, I will have to assign all group members to this variable i.e. hardcoded name. but, in future if we make any changes to this group then I will have to update workflow variable also. Commented Oct 12, 2018 at 6:29
  • @MortenK this is what I am not able to perform. If I put my name directly ,then it is working. but if I Put Group Name, I think its not able to extract user from this group Commented Oct 12, 2018 at 6:31
  • Have a look at my answer using the REST API it is indeed possible to validate if a user is a member of a group.
    – Morten K
    Commented Oct 12, 2018 at 6:32
  • Sorry, my solution doesn't work with a group. I used a list item with a multi person field and converted that to a string.
    – JJD
    Commented Oct 12, 2018 at 6:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.