You are currently viewing ServiceNow Script Action – A Detailed Guide!

ServiceNow Script Action – A Detailed Guide!

Hello Spectaculars,

Welcome to this new article where I provide basic information about ServiceNow Script action. Do let us know your feedback about the explanation and if you have any questions in the comment section.

What are Script actions?

On a very basic level, script actions are scripts that execute only after an event is triggered. This means that once an event is triggered (mostly by a Business rule using the gs.eventQueue function), your script action gets executed and performs the task you configured.

When an event is triggered, these scripts run on the server side and in the background (i.e., asynchronously).

script actions servicenow

Why are we using Script actions?

As we discussed, script actions run on the server side asynchronously, so we can use them to perform any kind of activity after the event is triggered. These are designed to perform tasks that require a large amount of time or resources, such as updating a large number of records after integration, etc.

A few examples of ServiceNow Script action?

E.g., Updating the work notes of all the related CIs once the parent CI is modified.

In this example, we triggered an event after the parent CI was updated. The trigger of the event executes the script action, finds all the related CIs, and updates the work notes with the appropriate comments. This can all be done asynchronously, without any hassle for the user.

Scripting options and objects available in the script action

Yes, scripting actions is simple. You can use all the server-side methods and functionality. You can access the Parm1 and Parm2 values of the event as well.

The object’s event and current are also available in script actions. Use event.parm1 or event.parm2 or event.sys_created_on, etc. to access the values using the event object.

Most probable Interview questions about Script actions?

Below are a few important areas you can focus on –

  • The concept of asynchronous script actions.
  • Why do we use script actions?
  • About the scripting objects available in script actions.

This Post Has One Comment

  1. John Deep

    Very informative

Leave a Reply