Applies to: NITRO Custom Actions and Workflows (SharePoint Online and On-premises)
For complete list of functions, please refer to this article.
This article describes the functionality and syntax of functions ‘GetGroupMembers’ and ‘Join’ in NITRO Workflows and Custom Actions.
This function is used to fetch the users that are members of a SharePoint (SP) group or an Active Directory (AD) group. This function fetches only those users that are directly the members of the specified SP/AD group. It will not fetch users that are members of the nested groups within the group.
This function can be defined in two ways:
With Expression Builder:
Without Expression Builder:
$getgroupmembers(displayvalue, joinchar, usercolumn, output)
Parameters to be defined in above function:
Display value: Specify the user attribute that is to be fetched. Below are the supported values:
Join char: This is required if the output type is ‘string’. Specify the character/string as a separator between each user value.
Example: Semicolon (;) or ;#
User column: Specify a person or group column placeholder that will contain one or more AD/SP groups. This person or group column can contain more than one group and this function will get users from all the groups.
- Direct group names or variables are not supported, only user columns are supported for this parameter.
- If user column has one or more direct user values (other than groups), then those are also included in the output.
Output: Specify the type of output that is to be returned by this function. Below are the supported values for this parameter.
- “array“: Get the output as an array. This output can be used to loop through each user and take the required action. For example, using the loop action in custom action or workflow manager a task can be created for each user in the output.
- “string”: Get the output as a text value where each user attribute will be separated as per the input given to function.
In this example, we want to fetch the ‘name’ attribute for each user. Output type is string and separator is semicolon.
‘Assigned Team’ is a user column in the current list. If this column has a SharePoint group as the saved value for an item, then users from that group will be fetched.
Example output with ‘name’ attribute: James Restivo;Joe Bloggs;John Smith;Ryan Stephani
Example output with ’email’ attribute: firstname.lastname@example.org;email@example.com;John.firstname.lastname@example.org;email@example.com
This function takes as input an array of values and outputs a string by concatenating these values.
With Expression Builder
Without Expression Builder
Syntax: $join (separator, [placeholder])
Parameters to be defined in above function:
- Separator: provide the character or string to separate the values in the output.
- Placeholder: Provide the variable that has the array of values.
In above example,
VarUsers: This variable has an array of user values.
Sample use case for GetGroupMembers function: Create tasks for approvers specified in a column in a list item.
- This action uses “Requests” and “Approval Tasks” lists.
- “Approvers” is a multi-selection enabled person or group column in “Requests” list. Select ‘Allow selection of’ option to ‘People and Groups’.
- Mention setting name that allows groups to be selected in user column.
- “Approvers” column in Request item will be filled with the required group. For each user in the specified group, we need to create a task in the “Approval Tasks” list.
- “Approval Tasks” list has a lookup to “Requests” list. This way each task will be linked to the request item for which it has been created.
- This action is configured on the “Requests” list.
- Define a variable to get the members in the group specified in ‘Approvers’ column in “Requests” list item.
- User the variable in the loop action to iterate for each user in the group.
- Configure a create item action in the loop body to create a task for user in the current loop iteration.
Action 1: Run loop for all approvers
Configure loop action for variable ‘varApprovers’ defined above.
Action 2: Create tasks for all approvers
Configure create item action to create task for each user.
Column mapping for Assigned To:
Action 3: Update worklog in Request
Configure update item action to update the worklog in request.
In below request item, “Crow Canyon Managers” group is selected in the ‘Approvers’ column.
Below users are the members of “Crow Canyon Managers” group:
- James Restivo
- Joe Bloggs
- John Smith
- Ryan Stefani
Tasks created for above users: