Please enable JavaScript to view this site.

Process Designer

Navigation: PHP API > Use process messages

Determine process messages (getMessage)

Scroll Prev Top Next More

This function allows you to determine process messages. Optionally the language, in which the message should be received, can be entered. In case the process message contains place holders, replacements can be passed.

Parameter

Type

Description

$messageName

string

Name of the process message

$languageName

string

Language, in which the message should be displayed (optional)

$replacements

array

Array with the replacements for the place holders (optional)

The function returns the process message as a string. In case of an error a JobRouterException is thrown.

In case there is no language entered, the message is returned in the language of the user who sent the step. In case it is a system step, the value is returned in the default language of the process. In case a specific language is passed as a second parameter, the output will be displayed in this language. In case the message does not exist in the stated language, a JobRouterException is thrown.

When a process message was defined that contains place holders (such as e.g. "The value must be between #{x} and #{y}"), you can pass an associative array as a third parameter containing the replacements for the individual place holders. In this example the structure of the array has to look as follows:

$replacements = array('x' => 100, 'y' => 1000);

Please note: If the function is used in a box action function, no process-related variables are replaced in the process message (e.g. [jr_incident]).

Examples:

Process message MESSAGE1:

German: 'Hier können Sie Ihre Kommentare eintragen'

English: 'Here you can enter your comments'

 

// Determining a message in the current language (English)

$message = $this->getMessage('MESSAGE1'); // Here you can enter your comments

 

// Determining a message in German

$message = $this->getMessage('MESSAGE1', 'german'); // Hier können Sie Ihre Kommentare eintragen

 

Process message MESSAGE2:

German: 'Der Wert muss größer #{betrag} sein'

English: 'The value should be greater than #{betrag}'

 

// Determining a message and replacing the place holder #{amount}

$replacements = array('amount' => 100);

$message = $this->getProcessMessage('MESSAGE2', '', $replacements); // The value should be greater than 100