cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

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

Jump to solution

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?

0 Kudos
Reply
5 Replies
Workflow Hero

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

Jump to solution

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

0 Kudos
Reply
Workflow Hero

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

Jump to solution

also, what type of field is Site Code?

0 Kudos
Reply
Workflow Hero

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

Jump to solution

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.

0 Kudos
Reply
Workflow Hero

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

Jump to solution

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.

0 Kudos
Reply
Workflow Hero

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

Jump to solution

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

0 Kudos
Reply