Skip to main content

Use information of the current logged in user

Bizagi provides several functions that allow you to find and manipulate information about the current user.

The user information can be retrieved depending on whether there is context or not (if there is an ongoing case or the expression is used outside of a case):

  • Use Me.WorkingCredential, when it is required to use the information of the current user allocated to the current task in Process forms or expressions (i.e., with context).
    View an example.

  • Use Credential, when it is required to use the information of the current logged in user in Query, Summary, or global forms (i.e., without context).
    View an example.

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

WorkingCredential3

The information available about the current user is:

PropertyDescription
AreaNameReturns the user's area name.
FullNameReturns the user's full name.
IsInPositionReturns True if the user has a specified Position, False otherwise.
IsInRoleReturns True if the user has a specified Role, False otherwise.
IsInSkillReturns True if the user has a specified Skill, False otherwise.
IsInStakeholderReturns True if the user has a specified Stakeholder, False otherwise including when a Stakeholder is disabled.
UserIdReturns the user's id.
UserPropertiesReturns the value of a specified user property.

Examples

The following examples will illustrate how to use these functions:

  • Evaluate if the user allocated to the current task has a specified Role.
  • Obtain information of the logged in user.

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 more efficient: 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

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

To obtain this information in Query, 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.

WorkingCredential1

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:

WorkingCredential1

//If the person visualizing the Global form hold the role Sales team member

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

{

//Show the information

true;

}

//Otherwise

else

{

//Hide the information

false;

}

Finally save the expression.