Use information of the user allocated to the current Task

<< Click to Display Table of Contents >>

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

Use information of the user allocated to the current Task

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

 

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

 

WorkingCredential3
 

The information available about the current allocated user is:

 

Property

Description

AreaName

Returns the user's area name.

FullName

Returns the user's full name.

IsInPosition

Returns True if the user has a specified Position, False otherwise.

IsInRole

Returns True if the user has a specified Role, False otherwise.

IsInSkill

Returns True if the user has a specified Skill, False otherwise.

IsInStakeholder

Returns True if the user has a specified Skill, False otherwise.

UserId

Returns the user's id.

UserProperties

Returns the value of a specified user property

 

Example

The following example will illustrate how to use these functions.

 

Evaluate if the user allocated to the current task has a specified Role

Suppose a bank has a business policy to make the Credit Request process a more efficient process: when the request is created by a person who has a Disburser Role, then the case does not need to go through the Credit Analysis activity.

 

In order to skip the activity, the RequiresStudy Boolean attribute was created. If the attribute value is True, then the case will go through Credit Analysis. If False, the Credit Analysis will be bypassed.

 

WorkingCredential4

 

The following rule evaluates if the current user has a Disburser Role. If the condition is met, the case does not need any further study.

This rule is executed On Exit of the first activity of the Credit Request process.

 

WorkingCredential2

 

 

WorkingCredential1

 

 

//Evaluates if the current user has the Role "Disburser".

 

if(Me.Case.WorkingCredential.IsInRole("Disburser")==true)

{

//If the condition is met, the attribute RequiresStudy will be set to false and the activity skipped

 <CreditRequest.RequiresStudy>=false;

}

else

{

// If not met, the attribute RequiresStudy will be set to true ensuring the process enters the Credit Analysis Task.

 <CreditRequest.RequiresStudy>=true;

}

 

 

Obtain information of the logged-in user in a Global or Summary Form

Some times it might be necessary to identify who is the user visualizing a Global or summary form, specially in situations where some information must be shown/hidden according to specific users properties (i.e Role).

 

To obtain this information in Global and Summary forms you can use the method Credential with the same structure of Me.WorkingCredential method.

 

Suppose in a Sales opportunity management Process the information of Customers and Partners must be only displayed to the Sales team members when they consult the status of a case. The rest of the information is displayed to any user.

 

Suppose the Sales team members hold a role. To show or hide the information of Customers and Partners in the Global form of the Process we can use a visibility expression.

 

Go to the Global form and set Expression  as visibility condition on the Customer and Partner information.

 

WorkingCredential5

 

Create an script expression and add an expression element.

Use the Credential.IsInRole function to evaluate if the user visualizing the form holds the required role:

 

 

WorkingCredential6

 

//If the person visualizing the Global form hold the role Sales team member (id=100098)

if (Credential.IsInRole("SalesTeam")==true)

{

//Show the information

 true;

}

//Otherwise

else{

//Hide the information

  false;

}

 

Finally save the expression.