logo

NJP

Make a Better Notification with System Properties and Mail Scripts

Import · Jan 07, 2019 · article

The article below is intended for any person customize their Notifications. A working Javascript and HTML is useful but not required.

Introduction

We often focus on getting job done and ready to be delivered. Of course this is important but sometimes we need more than just doing it. In the following article, we will look how to automate and centralize data in one place in order to become scalable and easier to find and edit.

Here's a few things we will cover:

Use Case Example
Automate properties (sys_properties) System properties store configuration information that rarely or never changes. Each time you change or add a system property, the system flushes the cache to keep all nodes in the cluster in synch. This cache flush has a very high performance cost for one to 10 minutes, which can potentially cause an outage if done excessively. To prevent such outages, do not use a system property to store configuration information that changes more than once or twice a month. I usually update the "From" field.
Use email templates (sysevent_email_template) Enable administrators to create reusable content for the subject line and message body of email notifications. Usually I define a mail_script (to use a standard style for all notifications), define subject and message.
  1. In the Navigation filter, enter sys_properties.list.
    The entire list of properties in the System Properties [sys_properties] table appears.
  2. Verify that the property does not exist by searching for the property name.
  3. Click New.
    Usually I use "company.default.notification.from".
  4. Complete the System Property form.Type: String
    Value: Community Article email@service-now.com
  5. Navigate to .
  6. Click New.
  7. Fill in the fields, as appropriate.
    Tab When to run
    When: BeforeOn Insert (check)On Update (check)
    Tab Advanced
    current.from = gs.getProperty("company.default.notification.from");

gs.addInfoMessage('Loaded company.default.notification.from value');

Fill in the form fields (see table).

Labels:

image

View original source

https://www.servicenow.com/community/developer-articles/make-a-better-notification-with-system-properties-and-mail/ta-p/2330253