--- title: Write a script for an automation message variable description: Write JavaScript code input for variables that are added in the message of an insight rule. locale: en-US canonical_url: https://www.servicenow.com/docs/r/australia/integrate-applications/automation-center/create-message-variable-auto-center.html release: australia product: Automation Center classification: automation-center topic_type: task last_updated: "2026-03-12" reading_time_minutes: 1 breadcrumb: [Creating insights, Working with automations, Use, Automation Center, Workflow Data Fabric] --- # Write a script for an automation message variable 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](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/integrate-applications/automation-center/create-insight-rule.md). 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](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/integrate-applications/automation-center/insight-rule-form.md). |
| 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](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/integrate-applications/automation-center/insight-rule-form.md). |