Write a script for an automation message variable

task australia Updated Sep 10, 2026 1 min read create-message-variable-auto-center.md
Raw file servicenow.com

Write JavaScript code input for variables that are added in the message of an insight rule.

Before you begin

This task must be performed in the classic environment.

Create an insight rule. For more information, see Create an insight rule.

Role required: sn_ac.automation_technical_user or sn_ac.automation_admin

About this task

When an insight rule is processed, it generates an insight. Insights appear on the Insights widget in the Executions dashboard of Automation Center Workspace.

An insight trigger activates the associated insight rule to run.

An insight rule doesn’t run unless it’s mapped to an insight trigger.

Procedure

  1. Navigate to All > Automation Center > Administration > Insight Rules.

  2. Open an insight rule that you want to write JavaScript code for the associated message variable.

  3. On the Automation Message Variables tab, select a variable.

  4. On the form, fill in the fields.

Field

Description

Name

Name of the automation message variable.This field is auto-generated.

Field

Qualifier for message variable.Values in this list appear depending on the entry that is selected in the Applies to field while you’re creating an insight rule.

This field appears only when the Applies to field is selected and when the Threshold type field is empty, while you’re creating an insight rule. For more information, see Insight rule form.

Application

Name of the associated application.This field is auto-generated.

Automation insight rule

Name of the associated insight rule.This field is auto-generated.

Advanced

Advanced script.This field is auto-generated.

Script

Text field that accepts JavaScript code input and provides controls, such as syntax checking and formatting.For example, to return a value, enter return 100;.

This field doesn’t appear when the Applies to field is selected and when the Threshold type field is empty, while you’re creating an insight rule. For more information, see Insight rule form.

5. Select **Update**.

Parent Topic:Create an insight rule

Search documentation
Search document titles and file paths on the australia branch