Obtain and use Vocabulary values

<< Click to Display Table of Contents >>

Navigation:  Bizagi Studio > Process wizard > Business Rules > Business rules examples >

Obtain and use Vocabulary values

Bizagi allows you to create Vocabularies or Sequences that can be configured for access from one or more processes or applications.

Vocabularies and Sequences can be invoked from within business rules by using a set of functions available in the Miscellaneous category.

 

Miscellaneous

 

Obtain a Vocabulary definition

To obtain the value stored in a specific Vocabulary use the resolveVocabulary function.  

 

The syntax of this function is:

CHelper.resolveVocabulary(Me,"VocabularyName")

 

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.

 

CHelper34

 

In a expression module, use the Me.Duration function to set the duration of the Task

 

CHelper35

 

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.

 

CHelper36

 

The next image shows the complete expression:

 

CHelper37

 

Me.Duration=CHelper.resolveVocabulary(Me,"SLA");

 

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:

CHelper.GetNextSeqValueStr("SequenceName")

 

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).

 

Sequenceexample2

 

 

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.

 

 

Sequenceexample3

 

We will assign the sequence value to the Internal Identification Number attribute belonging the StudentApplication Entity.

 

Sequenceexample1

 

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.

 

Sequenceexample5

 

//Assign the next sequential number to the Attribute

<StudentApplication.InternalIdentificationNumber>=CHelper.GetNextSeqValueStr("InternalIdentificationNumber");

Finally, click OK to save the changes.