Script actions

You can use script actions to create server-side scripts that perform a variety of tasks, such as modifying a configuration item (CI), or managing failed login attempts. Script actions are triggered by events only.

Configuration

To create a new script action, navigate to System Policy > Events > Script Actions and click New.

Field Input Value
Name

Type a unique name for your script action.

Event Name

Select the event to use for this script. If you do not find an event for your script action that suits your purpose, you can create a new one.

Application

The application that contains this script.

Order

The order in which the script will be executed.

Active

Select the check box (true) to enable this script action.

Condition Script

Create a statement for a condition under which this script should execute. The system only parses the Script field if the condition evaluates to true. If you decide to include the condition statement in the script, leave this field blank.

Script

Create a script that runs when the condition you define evaluates to true. Two additional objects are available in this script:

  • event: a GlideRecord - the sysevent that caused this to be invoked. If you wanted so get this first parameter on the event, you would use event.parm1 or event.parm2 for the second parameter. For the date/time of the event, use event.sys_created_on. To get the user ID that created the event (if there was a user associated), use event.user_id.
  • current: a GlideRecord - the event scheduled on behalf of (incident for example).

This is a sample of a script action that creates an email notification for Workflow activity:

Figure 1. Script action workflow