Use Case - Using Usercollection for multi-user field updates

<< Click to Display Table of Contents >>

Navigation:  NITRO™ Workflows > Workflow Use Cases >

Use Case - Using Usercollection for multi-user field updates

Workflow Use Case

Using the ‘Usercollection’ Function

 

Description

The Usercollection function allows you to combine single user values into a mulit-user enabled field automatically. This function can be used directly in Column/Field Mappings or as part of a workflow WF Variable action. The following examples illustrate its use in each scenario.

 

Examples

1) In Field Mappings

In this scenario we have a multi-user enabled field ‘Approvers’ and two user fields ‘User1’ and ‘User2’.

We want to update the multi-user field ‘Approvers’ with users in fields ‘User1’ and ‘User2’.

To do this use the ‘usercollection’ function in Field Mappings with expression builder as shown below.

 

 Column mapping with EB in usecase4

 Expression Builder:

         EB usecase4

 

 Syntax without expression builder: $usercollection([User1|User1],[User2|user2])

 

2) With WF Variable Action

In the second scenario we have a field ‘Approvers’ in the Configurations list where different approvers are configured for different departments.

When an item in the Purchase Requests list with a department of ‘Sales’ is submitted for approval, we will fetch approvers for the department from the ‘Configurations’ list and create a task for each approver.

To do this we create a workflow on the Purchase Requests lists’ Item Modified event as described below.

Workflow:

 workflow image usecase 4 new

Workflow Execution Condition:

condition for usecase4 workflow

Variable:

Define variable usecase4

         

Action Settings:

Workflow setting page usecase4

Action 1 : GetApproversForDepartment (Query List Action)

Create a query list action to get an item from Configuration list for the current department.

Query list in usecase 4 workflow

Fetch item from query list where department value is eu=qual to current item department value

Action 2: Set Variable

Create a WF Set Variable action to store all the approvers of fetched depatment in above step.

 Set Variable action usecase4

Expression Builder Syntax:

 Expression builder usecase4

Syntax to set variable value without expression builder: $usercollection(GetApproversForDepartment##Approvers)

GetApproversForDepartment’ is the Query list action name(Action 1).

'GetApproversForDepartment##Approvers' gets the Approvers from the item returned by the query list action.

$usercollection(GetApproversForDepartment##Approvers) converts the approvers in to user collection and stores in to WFVariable ‘varApprovers’ here.

Action 3: Create Approver Tasks (Create Item Action)

Configure a ‘Create Item’ action to create tasks for each approver in WF Variable.

 Create Approver task action usecase4