Vocabularies and Sequences can be invoked from within business rules by using a set of functions available in the Miscellaneous category.
Obtain a Vocabulary definition
To obtain the value stored in a specific Vocabulary use the resolveVocabulary function.
The syntax of this function is:
In a Claims and Complaints process a case must be solved in a specified time. This time is established according to a Service Level Agreement or SLA, that is the maximum allowed time to resolve a case. The duration of the Resolve Task must be set based on the SLA, and it is used to collect statistics and analyze the process performance. As the SLA can change according to the Company´s policies it is defined as a Constant Definition in a Vocabulary.
In order to set the Duration of the Resolve Task create an expression On Enter of this Task.
In a expression module, use the Me.Duration function to set the duration of the Task
To assign a value to the Duration, call the resolveVocabulary function and pass as input parameter the SLA definition. Just select this constant definition from the Process Vocabulary list and the complete function will be automatically inserted.
The next image shows the complete expression:
Finally click OK to save the changes.
Obtain the next value of a Sequence
To auto-generate numbers based on a defined Sequence you should use the GetNextSeqValueStr function.
The syntax of the function is:
Suppose you have a Students Enrollment process where the Administrative Department of a University registers and enrolls students. Once the student has been enrolled, a consecutive number is generated to identify him/her within the university. This number will appear in the student identification card.
To assign the next sequential number to an enrolled student, define the particular Sequence in Bizagi Studio.
(In the Expert View go to the Configuration tab. Select the Sequences option).
In the fourth step of the Bizagi Process Wizard, select Activity Actions.
Click the Task where the sequence will be assigned and create an expression.
We will assign the sequence value to the Internal Identification Number attribute belonging the StudentApplication Entity.
Call the GetNextSeqValueStr function to obtain the sequence value. Pass as the input parameter the name of the sequence previously created. The next image shows the complete expression.
//Assign the next sequential number to the Attribute
Finally, click OK to save the changes.