Set workflow variable to permission group

  • 6 January 2017
  • 3 replies
  • 1 view

Badge +9

I have a problem using a Person or Group variable in a workflow. I set the variable to a Manager (field in the current item) or a SharePoint permission group: (TEST) Approval Group. Then I use this variable to assign a task or send an email. If it is set to the Manager it works. If I set it to the permission group it fails incorrectly resolving the name of that permission group (see below: 896;#(TEST) Approval Group). Is this the expected behavior? Interestingly if I set a default for this variable to the permission group it works!


3 replies

Badge +6

If you set the group as the default value of the variable, does the group name also appear with the prefix "896;#"? The E-Mail action is trying to send an E-Mail to "896" which of course cannot work. Maybe there's a bug which leads to this prefix.

You could also work the a text variable instead of a Person or Group variable, this should also work for your case.

Userlevel 3
Badge +9

If you put the group name directly into the send notification (not via a variable), it will work.  When you use a variable like in your example, it converts the group into a string that has both it's ID and Name.  The send notification can't convert that back into a group.  To get this to work, after you set the group variable, do an extra step to remove the group number so that only the name is left.  I was able to use a RegEx to remove it.  I used the pattern "d*(;#)" with Replace Text, and left the replacement blank.  I saved the results in the same variable, and the notification worked. 

Badge +9

Thanks but text variable wouldn't work for users with the same Display Name.

Reply