Example User Properties
From Business Process Management, BPM and Workflow Automation Wiki | BizAgi BPMS
<keywords content="keywords"> User Properties, properties, user property, getUserPropertiesAsHashTable </keywords>
Example 1 User Properties
Bizagi contains a set of properties such as name, e-mail, immediate superior, etc. However, a project can have additional user properties required for processes or assignations, or simply as additional user information.
In this example, three new user properties are created: Budget Areas, Identification Number and Cost Center.
The properties can have 1-N or N-N relations with the parameterization entity or the system entity, or they may not have any relation, in which case, there will be a simple data type.
In the case of the example, Cost Center has a 1-N relation with the Cost Center parameterization entity because one user can belong to one cost center and one cost center can have many users. For the case of Budget Areas, there is an N-N relation with the Budget Area Parametric Entity, because one user can belong to several budget areas and one budget area can have many users. Last but not least, for the user property Identification Number is a simple property that will be defined as whole-type data and must be entered manually for each user.
To select, change and administer the created user properties, open a web application.
Go to the Admin menu and select Users. Then, select a user. The user properties will be shown in the last tab: Additional Information.
The Display Order in user properties is used to define, using whole numbers, the order in which additional user properties that are included to be captured in the user administration module will appear in the web application. The user properties will always be displayed in the Additional Information tab, which is the last of the user properties displayed. Visual Order also allows the user to use negative numbers. Therefore, if field A has a Visual Order = 1 and field B has a Visual Order = -1, field B will be displayed before field A.
As you can see, Budget Area property is displayed as a combo with the values of the parameterization entity that it is related to, and it has an add button to select all those to which the user belongs.
The User Property Identification Number is displayed as a field where the user will enter the data requested.
Available for assignments means it will be enabled in the user property combo displayed when the users assigned to an activity are defined as illustrated below.
Example 2 User Properties
The following is an example of an expression that returns a “Users Array”, depending on a User Property. The property used will be Boss. Thus, all users that have the same Boss will be saved and returned, to be used in an assigment rule.
In this case, the Boss id thath will be used to filter has been previously saved in an attribute of the data model and then assigned to a variable.
The code of the rule is the following:
Example 3 : Other Methods
Bizagi has many ways to obtain information from users data. Depending on the type of search is possible to make direct searches on the whole entity as in Example 2 (using Entity Manager) or it is also possible to use functions that provide some advantages over the EntityManager.
GetUserPropertiesAsHashTable()
This function returns a hash-table object which represents a collection of values. Hash-tables are good for doing a quick search on things. If we have an hash-table full of data (say 100 items) we just need to know the position where a specific item is stored in the table, to quickly access it. For instance if we just happen to know that the item we want it is at position 3; It is possible to apply:
var myitem= myHashTable[3];
In order to obtain the user properties of the participants, you can use the getUserPropertiesAsHashTable method of the Assignees object in a business rule or expression. Remember that the Assignees object has the advantage that it returns information from users who are or have been involved in the business case (context).
In the previous example the value of the 'property_name' for the user in the position [i] of the users hashtable is going to set the PropValue variable.
The following is an example of an expression that returns a “Users Array”, depending on a User Property. The property used will be Boss but this time we need to find all users with the same boss that has been participated in the case. So, the solution will use the method getUserPropertiesAsHashTable and then the assignation rule will select one oser of the arraylist object.
The code of the rule is the following:
In the last example the hash-table is used to return the list of properties of the users that has been working in the case and then fill the arraylist with all the idUsers and return the arraylist.
WorkingCredential.UserProperties
If we need only the user properties of the actual user assigned to the case it is not necessary to use the hash-table. In that case the UserProperties method from the WorkingCredential object is enough. Remember that the WorkingCredential object contains all the information of the actual user.
The following is an example of an expression that returns the idBossUser of the actual user and then the assignation rule will use this id. The property used will be Boss
It is important take into account that the name of the User-Propertie between brackets has to be in lower case. (i.e idbossuser, iduser )
Note: User properties are available to be created in the development environment. To guarantee the correct performance of all environments once deployed user properties cannot be deleted. If new user properties are created, make a new deployment to take them to production. Then admin user must configure them for each user |
<comments />