Creating and attaching script validators
Creating a validator
A script validator is one of the artifact types in the repository. To add a script validator, go to the tab Library → Script validators, and then click the button on the right-hand side Add script validator.

Edit window
The edit window in the repository allows you to change the validator content and the returned keys and default error messages. In the section Parameters all inputs and outputs resulting from the validator code content should be added (error keys). The parameters window can be displayed by clicking the button in the left panel
.
More information about the editor itself can be found in Script validator editor.

Attaching on the application
Attaching a script validator to an application does not differ from attaching a standard validator. For a specific component in the panel Properties you should select Data quality → Validators → Add validator, and then search for its name. In the tab Input parameters you should select the appropriate component in the field Choose a component or a constant. The switch located in the column Call when empty is responsible for invoking the validator even when there is no value in the specified field (e.g. when a value is removed from a text field).

Creating a validator error message
The content of the script validator's error message (key translation) must be defined in the component/application - after attaching the validator. Adding the message content in the script is not an error, but it will not be visible in the component/application edit window. After attaching the validator, both the key and its translation will display the key name defined in the script validator content:

You should edit the translation column and enter the text of the message that should appear when the validator returns a specific error message key.
If it is necessary to use variables in the error message, these variables should be listed in the code as parameters (parameters: [value1, value2 etc.]), and then referred to in the error message in the component/application as follows: {0} for the first parameter, {1} for the second parameter, {2} for the third, etc.


Last updated
Was this helpful?
