FI Finnish
SE Swedish
FR French
PL Polish
DE German
US English (US)

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

English (US)
FI Finnish
SE Swedish
FR French
PL Polish
DE German
US English (US)
  • Log in
  • Home
  • Platform
  • ESM
  • Other Technical ESM Documentation
  • Handler Documentation

Handler - Validator

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Service Management
    Matrix42 Professional Solution Matrix42 Core Solution Enterprise Service Management Matrix42 Intelligence
  • Identity Governance and Administration (IGA)
    IGA overview IGA solution library
  • Platform
    ESM ESS2 ESS Efecte Chat for Service Management Integrations Add-ons
  • Release Notes for M42 Professional, IGA, Conversational AI
    2026.1 2025.3 2025.2 2025.1 2024.2 2024.1 2023.4 2023.3 2023.2 2023.1 2022.4 2022.3 Release Information and Policies
  • Other Material
    Terms & Documentation Guidelines Accessibility Statements
  • Services
+ More
    • Service Management

    • Identity Governance and Administration (IGA)

    • Platform

    • Release Notes for M42 Professional, IGA, Conversational AI

    • Other Material

    • Services

Handler - Validator

Validator handler uses a Python expression in validating a value in the parent attribute. The handler evaluates the expression and displays an error if the expression returns a false value.

For information about Python, please visit www.python.org. A quick tutorial on Python can be found at www.python.org/doc/tut. Efecte uses a Python implementation called Jython. Jython specific documentation is available at www.jython.org.

Validator handler validates the value only when the data is created or edited through the user interface: a normal data card edit or by multiediting (multiedit since 4.1 4113). Note: When multi editing data cards, the validation may fail because other fields of the data card doesn't match the validation and preventing saving the data card. A check will not be performed if the source data is imported to Matrix42.

The data is considered valid if expression or script result is one of the following:

  • Empty string ('' or "").
  • A number other than zero (0). Jython uses 1 instead of boolean value True.
  • Successful regular expression match.

Note the following error cases:

  • A non-empty string is interpreted as an error message.
  • 0 is invalid. That may be result of a boolean expression.
  • None is invalid. An unsuccessful regular expression match returns None.

You can use the Validator handler, for example, to compare the values of different attributes denoted by their individual attribute codes in the parent attribute's metadata.

Parent attribute value can be referred using the variable moniker _current.

For example, to ensure, that the parent attribute Amount is larger than Q2, attach the Validator handler to the attribute Amount and denote the following Python Validator in the metadata expression: _current>[attributeCodeQ2] . When saving, Validator handler evaluates the expression and returns an error to the user if the condition is not met.

The following tables provide information on the attribute settings and metadata requirements for Validator handler. Compulsory metadata is provided in a Required attribute metadata table.

Configuration of Validator handler varies from other handlers. Needed metadata names are given, admin must give the values only.

Table 1. Attribute Settings

Handler name Datatype
Validator Any

Table 2. Required Attribute Metadata

Name Value Description
expression [Python expression]

A valid Python expression (or script if isScript is enabled) for performing validation.

If the expression cannot be parsed, a referenced attribute value is empty or an unknown error occurs, the validation will pass and saving will proceed.

defaultErrortext [text_validator_error] The error text that will be returned to user if validation fails. This can be a plaintext or a presentation text code that is interpreted into user's selected language. text_validator_error is the default errorcode.
isScript [on | off]

When the value is on, expression is interpreted as a Python script.

Scripts are more powerful than expressions and can contain multiple lines, loops and other control structures. Also they are more complex to configure. Check examples of scripts below. If you want to interpret the expression as a script, check this box.

The result value must be set into a variable called _result.

More example configurations available below.

NOTE! This functionality may or may not be available on your system depending on licensing.

invalidOnError [on | off] When the value is on, an error occurring when executing the expression will cause the attribute value to be interpreted as invalid.

Table 3. Optional Attribute Metadata

Name Value Description
alwaysExecute true/false If this is true, the expression will be executed (as root) when the data card is saved and this attribute has a value. Default is false.

Validator handler also allows access to referenced data cards. The current card can be referred with this, and other data cards by their the class attribute code configured in the parent card. Currently supported methods for referred data cards are:

Table 4. Data Card Access Methods

Method Returns Example
get(attributecode) Single value found in the field with the given attribute code. If the attribute is multivalued, first value is returned. If attribute is a reference, a PythonEntity object is returned. this.get("support_person").get("email")
getAll(attributecode) Array containing values found in the field with the given attribute code. If attribute is a reference, an array of PythonEntity object is returned. max(getAll("product_prices"))

Script Examples

Ensure that current attribute value is between 50 and 100:

50<_current<100

Check that the length of the current field is exactly 8

len(_current)==8

Lets assume: 1) "car" is a single value reference of _this_ template 2) "limit" an integer attribute of _car_ template 3) Check that current attribute value is less than the limit from single car reference

_current<car.get("car_limit")

Decide the error message based on the current attribute and attribute with the code speed_limit. Requires isScript option:

if _current>speed_limit:
  _result='The value must be smaller than the speed limit!'
elif _current<0:
  _result='The value must be larger than zero!'

Check that the current field matches a given regular expression, where the input must be of form EFECTE-nnnnnn, where n is a number:

re.match(r"EFECTE-\d{6}",_current)

Check that the current field matches a given regular expression, where the input must start with an letter A and a number:

re.match(r"A\d.*",_current)

If the jobstate attribute has value Closed and the travel_time or actual_work_time attribute is empty, display an error message.

errorText = ""
if (this.get("jobstate")=="Closed" and this.get("travel_time")==None):
   errorText=errorText + "<br/>Please fill in the 'Travel time' field"
if (this.get("jobstate")=="Closed" and this.get("actual_work_time")==None):
   errorText=errorText + "<br/>Please fill in the 'Actual work time' field"
if (errorText != "" ):
   _result=errorText
validator handler operator verifier

Was this article helpful?

Yes
No
Give feedback about this article

Table of Contents

Related Articles

  • Attribute Metadata - ReferenceSearchFilter
  • Attribute Metadata - ShowCode
  • Attribute Metadata - Related Data Card Search

Copyright 2026 – Matrix42 Professional.

Matrix42 homepage


Knowledge Base Software powered by Helpjuice

0
0
Expand