Use information of the current assignees

<< Click to Display Table of Contents >>

Navigation:  Bizagi Studio > Process wizard > Business Rules > Business rules examples >

Use information of the current assignees

Bizagi provides several functions that allow you to find and manipulate information about the current assignees of the current Task. This group of functions all start with the sentence:

 

Me.Assignees[].

 

When the function is used, an array of users is returned. To use the function it is necessary to use brackets in order to specify the index of the user. 0 (zero) is the first position of the array.

If there is only one user assigned, the sentence will be Me.Assignees[0].attribute

 

This group of functions are available in Current assignees information category.

 

CHelper65

 

 

The information available about the current assignees is:

 

Property

Description

Id

Returns a collection containing the id's of all assignees of an activity.

BossId

Returns a collection containing the Boss of all assignees of an Activity.

FullName

Returns a collection containing the full name of all assignees of an Activity.

Location.Name

Returns a collection containing the location of all assignees of an Activity.

Positions

Returns a collection containing the positions of a specific assignee of an Activity.

Roles

Returns a collection containing the roles of a specific assignee of an Activity.

Skills

Returns a collection containing the skills of a specific assignee of an Activity.

UserName

Returns a collection containing the user name of all assignees of an Activity.

getUserProperties()

Returns a collection containing a specific user property of all assignees of an Activity.

 

 

Examples

The following examples will illustrate how to use these functions:

 

Obtain the Full Name of the current assignees

Obtain the Roles of the current assignees

Obtain user properties

 

Obtain the FullName of the current assignees

The Me.Assignees[].Fullname function retrieves the fullname of all the assignees of an activity.

To use the function it is necessary to use brackets in order to specify the index of the user. The function has the following syntax:

 

Me.Assignees[index].FullName

 

Suppose in a Customer Service Process you need to obtain the list of users assigned to a specific task. This list will be shown to end users through a collection called AssigneesList.

 

To build this list, create an expression as an on enter action, in the activity where it is required.

 

Use the Me.Assignees function to go through the list of assignees.

 

CHelper66

 

For each assignee create a new record in the AssigneesList collection by using the Me.newCollectionItem function.

 

CHelper68

 

Finally use the Me.Assignees[].FullName function to obtain the full name of each assignee and set it as the new record of the collection.

 

CHelper67

 

 

//Go through the list of assignees

for (var i=0; i<Me.Assignees.Count; i++)

{

//For each assignee create a new record in the collection

var NewAssignee=Me.newCollectionItem("CustomerServiceRequest.AssigneesList");

NewAssignee.setXPath("Name",Me.Assignees[i].FullName);

}

 

The list will be shown to end users as below:

 

CHelper73

 

 

Obtain the Roles of the current assignees

The Me.Assignees[].Roles function returns a collection containing the roles of a specific assignee of an Activity.

To use the function it is necessary to use brackets in order to specify the index of the user. The function has the following syntax:

 

Me.Assignees[index].Roles

 

Suppose in a Customer Service Process you need to obtain the list of users assigned to a specific task as well as their roles. This list will be shown to end users through a collection called AssigneesList.

 

To build this list create an expression as an on enter action, in the activity where it is required.

 

Use the Me.Assignees function to go thorugh the list of assignees.

 

CHelper66

 

 

For each assignee create a new record in the AssigneesList collection by using the Me.newCollectionItem function. Use Me.Assignees[].FullName to obtain the full name of each assignee and set it as the new record of the collection.

 

 

CHelper67

 

 

Now build an string with the roles of each assignee. Use Me.Assignees[].Roles to obtain the list of roles.

 

CHelper69

 

Go through the list of roles and concatenate their names to obtain a unique string by user

 

CHelper70

 

Finally use the obtained string as the new value for the Roles column of the new record of the collection. Then reset the string.

 

CHelper71

 

//Go through the list of assignees

for (var i=0; i<Me.Assignees.Count; i++)

{

//For each assignee create a new record in the collection

var NewAssignee=Me.newCollectionItem("CustomerServiceRequest.AssigneesList");

NewAssignee.setXPath("Name",Me.Assignees[i].FullName);

var RolesList=Me.Assignees[i].Roles;

 for (var j=0; i<RolesList.Count; i++)

 {

 var UserRoles=UserRoles+ "," + RolesList[j].Name;

 }

NewAssignee.setXPath("Roles",UserRoles);

//Reset the Roles string

UserRoles="";

}

 

The list will be shown to end users as below:

 

CHelper72

 

 

Obtain custom user properties

The Me.Assignees[].getUserProperties function returns a collection containing a user propety of a specific assignee of an Activity.

To use the function it is necessary to use brackets in order to specify the index of the user. The function has the following syntax:

 

Me.Assignees[index].getUserProperties["Property"]

 

Suppose in a Customer Service Process you need to obtain the list of users assigned to a specific task as well as a user property called Career. This list will be shown to end users through a collection called AssigneesList.

 

To build this list, create an expression as an on enter action, in the activity where it is required.

 

 

Use the Me.Assignees function to go through the list of assignees.

 

CHelper66

 

For each assignee create a new record in the AssigneesList collection by using the Me.newCollectionItem function. Use Me.Assignees[].FullName to obtain the full name of each assignee and set it as the new record of the collection.

 

CHelper78

 

Now obtain the Career property by using the Me.Assignees[].getUserProperties() and assign this value to the Career column of the new record.

 

CHelper79

 

//Go through the list of assignees

for (var i=0; i<Me.Assignees.Count; i++)

{

//For each assignee create a new record in the collection

NewAssignee=Me.newCollectionItem("Process.AssigneesList");

NewAssignee.setXPath("UserName",Me.Assignees[i].UserName);

NewAssignee.setXPath("Location",Me.Assignees[i].getUserProperties["Career"]);

}

 

The list will be shown to end users as below:

 

CHelper80