Display validations to end users

<< Click to Display Table of Contents >>

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

Display validations to end users

Validations are customized error messages displayed in the Work Portal informing the end user that data is missing or an error occurred in an activity. Validation messages are usually defined in On Exit Actions or in Table Validations.


If a validation is thrown when clicking Next in an activity, the process will halt and the error message will be displayed.

If a Validation is thrown when trying to save a new record of a table, then the new record will not be saved, and the message will be displayed instead.


Validations are configured using the ThrowValidationError function. The syntax of the function is:




The parameter of this function is the error message to be displayed when the validation is thrown.


The ThrowValidationError function is found in the Data Validation category.





In a Travel Request Process you have to validate that the Vacation's Returning date is greater than the Vacation’s Leaving date to be able to calculate the days of leave requested. If the dates do not comply with this condition a validation message is displayed to the end user to inform of the erroneous date.


To show a validation message use the ThrowValidationError function.


1.  Go to the fourth step of the Bizagi Process Wizard and create an expression On Exit of the Register Vacation Request Task.


Date Operations2

2. In an expression, compare the Leaving and Returning dates.


3. Type the error message to be displayed,"Returning Date cannot be less than the Leaving Date", as show below.


Date Operations10


if (<VacationRequest.LeavingDate>>=<VacationRequest.ReturningDate>)


 CHelper.ThrowValidationError("Returning Date cannot be less than the Leaving Date");



4. Click OK to save the rule.



5. In the Work Portal, enter a date in the Leaving Date field that is greater than the Returning Date value.

The validation message will look like this:


Date Operations19


Display localized validations

In some cases validation messages might need to be localized in order to meet languages of users to which they are displayed.

This can be done by using Extended Resources.


Suppose the validation message of the Vacation Request must be displayed in the language defined for the requester user. To do this, follow the steps bellow:


1. From the Expert view create an Extended Resource and define localization for the desired languages.


Date Operations37


2. Go to the fourth step of the Bizagi Process Wizard and create an expression On Exit of the Register Vacation Request Task.

In an expression element, define the condition required to show the validation message as in the previous example.


Date Operations38


3. Use the Me.Case.WorkingCredential.UserProperties method to obtain the language of the requester user.


Date Operations39


4. Use the CHelper.GetAttrib function to obtain the Culture name of the user´s language.


Date Operations40


5. Use the CHelper.GetStringExtended function to obtain the validation message in the required language.

This function uses three parameters:


Parameter 1: Name of the extended resource.

Parameter 2: Default message (Shown if the resource is not localized in the specified language).

Parameter 3: Language Culture Name.


Date Operations41


6. Finally use the CHelper.ThrowValidationError function to show the validation message.


Date Operations42


if (<VacationRequest.LeavingDate>>=<VacationRequest.ReturningDate>)



//Obtain the user language


//Obtain the user language name

Lang = CHelper.getAttrib("LANGUAGE",idLang,"CultureName");

//Obtain the localized message

LocalizedMessage= CHelper.GetStringExtended("ReturningDateValidation","Returning Date cannot be less than the Leaving Date",Lang);

//Display the localized message