Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Merged branch "DOC0000306" into parent

Notifications keep you updated on the new records, changes, and events in SimpleOne platform. Changes in any field of a task or a whole table may trigger outgoing notification emails. Use notification rules described below to define who receives information about particular changes in the system, and the scope of that information. 

SimpleOne has a set of out-of-the-box notifications: see the Available Notifications article to learn about them.

Notification rules


Notification rules are used when you need to set up notification sending rules, depending on various conditions, or in the case of the event happened.

You can create new notification rules, or modify existing ones. To create a new notification rule, please complete the following steps: 

Tip

Role required: notification_admin.

To create a notification rule, please complete the steps below:

  1. Navigate to the System Notification - Notification ;Rules.
  2. Click New , fill in the form and click Save.and fill in the fields.
  3. Click Save or Save and Exit to apply the changes.
Info

You can also create a notification rule through a form or a related list:

  1. Open the hamburger menu Image Added.
  2. Proceed to Configure → Notification Rules.
  3. Click New and fill in the fields.
  4. Click Save or Save and Exit to apply the changes.

Notification Rule form fields

FieldMandatory
Field
Description
NameYDisplayed notification name.
TableYChoose the target table for notifications. For example, if you
are creating
create a notification for
the
some Incident, then select the
itsm_incident
Incident table.
Active
Turn
NSelect this checkbox
on
if you
want
need to activate this notification
to be active
rule.
Inherited
Sys updated byInformation about who has updated the record
NSelect this checkbox if this notification rule should be applied to child tables of the selected table. For example, if you select the Task table, then this rule applies to the Incident, Problem, Change Request and other child tables of this table.
When to Send tab
Condition
ConditionsN

In this field, you can specify a

The

condition to meet before sending the notification. Use

the 
 to

 to build

the

a filter that will fit your needs

most.

the best.

Info

An empty condition always returns true.


Send whenY

The option-driven field providing the choice when the notification should be sent. Available choice options:

  • Record inserted or updated – when choosing this option, notification will be sent after record inserting or updating in the table specified. Relevant checkboxes must be selected.
  • Event is fired – when choosing this option, notification will be sent after an event is fired (see below).
InsertedNSelect this checkbox to send the notification
InsertedTurn this checkbox on if you want this notification to be sent
when a record is inserted into the table specified in the Table field.
Updated
Turn
NSelect this checkbox
on if you want this notification to be sent
to send the notification when a record is updated in the table specified in the Table field.
EventY

Event is a special record used by the system to log when specified conditions

met and

met and to take some kind of action in response to the conditions.

This field appears when the Event is fired option is selected in the Send when

The option-driven field providing the choice when the notification should be sent. Available choice options:

Record inserted or updated - when choosing this option, notification will be sent after record inserting or updating in the table specified. Relevant checkboxes must be marked.

Event is fired - when choosing this option, notification will be sent after an event is fired (see above),

field.

Who will Receive tab
Other recipientsN

In this field, you can add contacts to subscribe to the incident activities.

Available values in this field:

  • One or more email-addresses separated by comma or semicolon (for example, user@domain.com; example@example.com, test@example.com).
  • A templated string containing reference to the current user or email objects. For example, ${current.caller}${current.requestor.personal_email}. These templates strings support and can use Dot-walking.
  • A templated string containing reference to the record in Notification Script dictionary. For example, ${script:callerManagerEmail}

The value in this field can be combined out from the options above. For example:

${current.caller.personal_email}; ${script:callerManagerEmail}

Tip

Please check your template strings along with the system before production using. For example:

The ${current.caller.manager.email} template string will not work properly because the Caller field of the User table does not have the manager attribute.


UsersN
Who Will Receive tabUsers

In this field, you can list the users who will receive the notification within this rule.

Info

In case the user or user's email is defined twice in the Other

In this field, you can add contacts to subscribe to the incident activities. It can be email-address (for example, user@domain.com), or it can be defined by notification variables.Send selfTurn this checkbox on if you want to receive this notification too.What Will Contain tabSubjectThe displayed notification subject. MessageThe notification body in plain text.Message HTML

recipients and Users fields, the system will send only one message.


Send to selfN

Select this checkbox to send the notification to the person initiating notification sending if this person is in the recipient list. Otherwise, notification initiator address would be excluded from the To field of notification email.

Note

There are some nuances about this functionality:

  1. Emails with no recipient address populated (the To field is empty) will not be sent. They will be in the Ignored state.
  2. If the Send to self attribute is false and the email has only a notification caller as a recipient, a notification rule will create an email with the Ignored state.


Exclude delegatesNSelect this checkbox to ignore the notification rule for delegates.
What will Contain tab
SubjectNThe displayed notification subject. Notification variables and placeholders are supported there.
Notification templateNSelect the relevant notification template from the list.
MessageNThe notification body in plain text. Notification variables and placeholders are supported there.
Message HTMLN

The notification template in rich-text format. This field supports HTML tags, placeholders,

SimpleOne API methods

notification variables.

Tip

You can also use notification

variables

variables ${URI}

and

 and ${URI_REF}

there

 there. Their usage is described below.



Note

The server-side business logic may not work for system tables if the creation or updating of records is initiated by the backend. For example, an Import Set is created as part of loading an Import Source, or an Email is created as a result of a notification rule, and so on.

A list of table examples for which server-side business logic may not work:

  • Main Log (sys_log)
  • Script Log (sys_log_script)
  • Exception Log (sys_log_exception)
  • Record Deletion Log (sys_record_deletion_log)
  • Import Set (sys_import_set)
  • Activity Feed Item (sys_activity_feed_item)
  • Email (sys_email)


Use cases


We need to configure a basic notification for the Employee table, which implements the following logic:

  • When a new employee is added, all employees receive a notification.

We create a notification rule as below:

FieldValue
NameNew employee
TableEmployee
Active

True

When to Send tab
Send whenRecord inserted or updated
InsertedTrue
Who will Receive
Other recipients

company-group@example.com 

Tooltip
onlyIcontrue
appendIconinfo-filled
iconColorblue

This address represents a mailing list.


What will Contain
SubjectNew employee in the ${current.department} department
Message${current.display_name} is in our team!

Notification template


Notification templates are beneficial to pattern the notification process, being a very flexible tool; they . They provide a possibility to develop templates for different tasks and cases.

To create a notification template, please complete the steps below:

  1. Navigate to the System Notification → Notification Templates;.
  2. Click New , fill and fill in the form and then click Savefields.
  3. Click Save or Save and Exit to apply the changes.

Notification template Template form fields

FieldMandatoryDescription
NameYDisplayed notification template name.
Subject

Notification template subject. Notification variables are supported there.

Table
TableYIf the table is specified, then the template will be applicable only for this table; otherwise, it will be applicable for all tables.
SubjectY

Notification template subject. Notification variables and placeholders are supported there.

Message TextNThe notification template in plain text format. Notification variables and placeholders are supported there.
Message HTMLN

The notification template in rich-text format. This field supports HTML tags, placeholders,

SimpleOne API methods

notification variables.

Tip

You can also use notification

variables

variables ${URI}

and

 and ${URI_REF}

there

 there. Their usage is described below

.Message textThe notification template in plain text format.Sys created byInformation about who has created the record.

Sys updated by

Information about who has updated the record

.


Notification variables


Specify a notification variable using this syntax:

${variable-name

+

.variable-parameters}

Not all notification variables support the "variable-parameters" portion. When available, variable parameters are optional. See the list of available notification variables for variable names and available parameters.

Notification variables

issue Click issue: LINK

${URI_REF} Source: Click here to view the inquiry ${URI_REF}

${URI_REF} Output: Click here to view the inquiry: INQ0005555
VariableDescriptionExample
${current}This variable refers to the current record in the table specified.${current:.caller} -  – for example, if this variable was used in the Notification Rule in the Other field in the Who will receive tab, then the notification will be sent to the caller (the originator of the issue).
${event}

This variable refers to the specified event context in case if the notification was triggered by some event.

So, as you have got this context, you can get the values of the fields within the Event (sys_event) table related to this event.

${event.param_1}
${script}

This variable runs the specified script developed by using the Notification Scripts functionality.


Tip

The called script name should not contain spaces. They are not allowed to use within the structure like shown in the example.


${script:add_an_attachment}

${template}

This variable is used to link the notification template table (sys_notification_template) and the notification rule table (sys_notification_rule). When using it, you can stuff the template fields to the relevant notification rule fields.

${template.subject} - template_name} – for example, if this variable was used in any part of the notification Subject field, then the subject line kept stored in the template in the Subject field will be specified.will be applied to the relevant field.
Variables that allow displaying links to current record

${URI}


The link text is the unclickable link to the record.

${URI

_REF}Display a link to the record.
URI: The link text is the word LINK or any other word specified.
URI_REF:

} Source: Click here to view the task: ${URI}

${URI} Output: Click here to view the task: https://instance.example.com/record/task/160525805616015648

${URI_REF}The link text is the display value of the record.

${URI_REF} Source: Click here to view the

task: ${URI_REF}

${URI_REF} Output:

Click here to view the

task: TSK0005555

Notification scripts


Use the notification scripts  to dynamically change the parameters of the outgoing messages using the SimpleEmailOutbound class. 

You can use the same script in multiple email notifications and notification templates. To do so, add a ${script:script_name} embedded script tag to the notification rule or to the related notification template. The fields below are available for the script embedding:

  • Subject
  • Message
  • Message (HTML)
  • Other

To create a notification script, complete the steps below:

  1. Navigate to System Notification → Notification Scripts.
  2. Click New and fill in the fields.
  3. Click Save or Save and Exit to apply the changes.

Notification Script form fields

FieldMandatoryDescription
NameYDesirable script name for later usage in notifications and templates. Should not contain spaces.
ScriptY

Enter the script using SimpleOne server-side API, particularly, the SimpleRecord Server-Side, SimpleEmailOutbound and SimpleTemplatePrinter classes.
There are four objects available in the notification scripts:


To receive the values of the current and event objects, use dot-notation to address the properties relating to the column names and the current and sys_event tables. See the example below:

Code Block
languagejs
themeEclipse
titleExample
linenumberstrue
(function runNotificationScript(
    /* SimpleRecord */ current,
    /* SimpleTemplatePrinter */ template,
    /* SimpleEmailOutbound */ email,
    /* SimpleRecord */ event
    ) {

    email.setSubject(current.number + '- additional comment has been added');
    email.setBody(`A comment from: ${event.sys_created_by.display_name}: "${event.param_2}"`);

    if (current.days_count > 3 && !current.requester.vip) {
        email.addAddressCc(current.requester.email, current.requester.display_name);
    }

})(current, template, email, event);


Note

To locate where notification scripts are used, perform search against the version list. To do so, complete the steps below:

  1. Navigate to Configuration Pack → VCS Records.
  2. Click on the funnel icon Image Added on the top to open the Condition Builder.
  3. Create a filter containing the conditions listed below:
    1. JSON Copy CONTAINS script:script_name
    2. Table Name IS NOT sys_notification_script
    3. Is Current IS Yes.

In step 3a, specify your script name after the "script:" declaration. For example, "script:stop_notifications".

The selection example is given on the screenshot below.

Image Added


Table of Contents
absoluteUrltrue
classfixedPosition