Solved

Can I define a SharePoint group for setting item permissions using a variable

  • 20 August 2015
  • 6 replies
  • 22 views

I want to set the item permissions for submitted requests based on the site that submitted the request.  Each site has a SharePoint group with a name formatted "[site code] Members" where [site code] is the 3 character site code for each site and is an item property.  I created a workflow which sets a text variable to "[Site Code] Members", then sets item permission using that variable as the user.  When I run the workflow it says that the user is not found, even though it reads exactly right.  Is it possible to achieve this goal?

 

For a more specific example, I type "TUA Members" into the "Users" field in my workflow and it resolves the group name immediately.  When I leave it as the variable and run the workflow, the workflow output is "No user has been found with specified username "TUA Members".

 

Is there a way to dynamically define a SharePoint group name like this?

icon

Best answer by cassymfreeman 25 August 2015, 11:28

View original

6 replies

Badge +16

so site code is an item property?  can you confirm you are using the set variable action and choosing the value of Site Code Members

Badge +16

also, what type of field is Site Code?

Badge +16

if it's a lookup or choice column you might find that it is not bringing it back as three letters as you would expect.  try logging to history list the item property returned for the item property site code.

Thank you for your response, Cassy.

Yes, I am using the "Set Variable" action to set the value as you stated (Site Code Members).

Site Code is a text field.

I confirmed it is returning the correct value because the error in the history states "No user has been found with the name 'TUA Members'".

I also confirmed that this group name would otherwise resolve by setting the "Users" field in the "Set Item Permissions" action to "TUA Members".  But I noticed that this resolved immediately upon saving that action, as opposed to resolving when the workflow runs... which is what leads me to believe that what I'm trying to do isn't possible if the workflow doesn't actually resolve the user name while it's running.

Badge +16

OK instead of set variable, use Build string and enter [Site Code] Members and store that into your text variable for group name, and then set item permissions with that.  I have just tested it and it works a charm

Is it possible somehow to prohibit the usage of variables for setting permissions? I tested it with the Build string action but this is also not working for me, so I have the suspicion that our admins may have restricted something here.

Reply