Obtain Persona information

<< Click to Display Table of Contents >>

Navigation:  Low-code Process Automation > Studio Cloud - Authoring environment > Bizagi Studio > Process wizard > Business Rules > Business Rules examples > User information and experience >

Obtain Persona information

When you want to handle Persona's information, being related to the currently logged user or other users, you may rely on new methods provided by the Bizagi rules API.

 

Consider that one same user can belong to one or more Personas at the same time, or none at all.

Therefore and through the methods provided by Bizagi rules API, you will be able to create expressions that for instance allow you to:

 

Obtain the information related to a user's Persona configuration (a reference to the Persona instance), by parting from the user's Id and while specifying the type of Persona you want to fetch information from.

 

Obtain all the users (an array list) who are mapped/belong to a given Persona.

 

Obtain information relating a Persona, given a user

The following function allows you to obtain the Persona object given a user, and navigate it using XPath.

 

CHelper.GetPersonasForUser(UserId, "PersonaName");

 

To navigate using XPath, the easiest thing is to declare a variable and use the getXPath and setXPath functions. However you can also perform the following

 

CHelper.GetPersonasForUser(UserId, "PersonaName").getXPath("attributename")

 

Property

Description

UserId

The function requires a user Id to evaluate the user and the Persona name.

PersonaName

A String with the name of the required Persona.

attributename

The name of the attribute within the Persona to be obtained

 

Example

In an Emergency room we need to allocate the Doctor who attended an emergency, to the next task, and we need to save his/her specialty in an attribute.

The following is the process' data model.

 

Stakeholder1

 

The following is the expression to obtain the Persona's object and navigate it.

 

 

var Doc = CHelper.GetPersonasForUser(Me.Case.WorkingCredential.UserId, "Doctor");

<Triage.Attendingdoctor> = Doc;

var speciality =  Doc.getXPath("speciality");

 

Obtain all users given a Persona

The following function allows you to obtain all the users related to a Persona object. This returns an array that can be navigated

 

CHelper.GetUsersForPersona("PersonaName");

 

Property

Description

PersonaName

A String with the name of the required Persona.

 

In an emergency room we need to obtain a list of all the users that are Doctors and save their names.

         

var allDoctors = CHelper.GetUsersForPersona("Doctor")

var listName="";

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

{

 var fullName = allDoctors[i].getXPath("associatedUser.fullName");

 listName=fullName+listName;

}


Last Updated 6/9/2023 3:27:25 AM