Skip to main content
Version: 1.22.3

Flash Messages

Flash messages, also known as popup or toast messages, are used to communicate with the users and inform them of important changes or errors that have occurred while they interact with record forms.

To set up a new flash message that is not in the "out-of-the-box" installation, you need to:

  1. Create a source message.
  2. Create message translations.
  3. Configure the business rule whose conditions trigger the message display.

Create a source message


All flash message texts are stored in the Source Messages (source_message) table.

To create a new flash message, complete the following steps:

  1. Navigate to System LocalizationSource Messages.
  2. Click New and fill in the Message field.
  3. Click Save or Save and exit to apply the changes.
note

The text of the source message must be in English.

You can also add translations of this message to any language. See the Localization and Multi-language Support article to learn more.

Configure a business rule


To display the message when a business rule is executed, configure the following parameters when creating or updating a business rule record:

  • On the Action tab, select the Add message checkbox.
  • In the Message field that appears, enter the message you need. Enter the message from the Source Messages table for it to be localized.

See the Business Rules article to learn how to create and configure business rules.

Configure a script


To add a flash message with a script, open the form of a record to which the message should be connected and find the Script field. You can use variables, dynamic links and translations in the flash messages.

The list of methods that can be used in the business rule to add a message:

SimpleForm:

  • s_form.addErrorMessage(message)
  • s_form.addInfoMessage(message, durationMilliseconds)
  • s_form.addSuccessMessage(message, durationMilliseconds)
  • s_form.addWarningMessage(message, durationMilliseconds)

SimpleSystem

  • ss.addInfoMessage(message, params)
  • ss.addErrorMessage(message, params)
  • ss.addSuccessMessage(message, params)

Examples:

A flash message script with a link
(function executeRule(current, previous = null /*not null only when action is update*/) {
const iaStats = new SimpleRecord('instance_activity_stats');
iaStats.get('ci_instance', current.sys_id);
if(iaStats.sys_id){
iaStats.active = false;
iaStats.update();
ss.addInfoMessage(IAStats <a href="/record/instance_activity_stats/${iaStats.sys_id}" target="_blank"><span style="color: #0050C8;">${iaStats.getDisplayValue()}</span></a> deactivated.)
}
})(current, previous);

A flash message script with a translation
(function executeRule(current, previous = null /*not null only when action is update*/) {
const message = new SimpleMessage();
const localizedMessage = message.getMessage('Inherits property has been activated for global UI action');
ss.addInfoMessage(localizedMessage);
})(current, previous);