<< Click to Display Table of Contents >> 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 requited 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.
The information available about the current 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. |
IsInPersona |
Returns True if the user has a specified Persona, False otherwise including when a Persona is disabled. |
UserId |
Returns the user's id. |
UserProperties |
Returns 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
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.
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.
//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.
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:
//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.
Last Updated 2/21/2023 9:27:33 PM