what is script action ?

elizabeth keen
Giga Contributor

what is script action in servicenow?

1 ACCEPTED SOLUTION

shubham jagtap
Tera Guru

Hi,

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.

Script actionsScript actions are server-side JavaScript code that is executed when an event it is listening to is triggered on the specified table. Just like any other server-side scriptscript actions have access to all the server-side glide APIs,script includes, and other server-side resources.

you can refer below link :

https://www.youtube.com/watch?v=Zo-KT9ASLYQ

https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/administer/platform-events/refere...

https://community.servicenow.com/community?id=community_question&sys_id=c71ccf25db9cdbc01dcaf3231f96...

https://subscription.packtpub.com/book/virtualization_and_cloud/9781787128712/10/ch10lvl1sec51/scrip...

after going throw this please mark it as correct/helpfull.

Thankyou.

 

View solution in original post

7 REPLIES 7

shubham jagtap
Tera Guru

Hi,

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.

Script actionsScript actions are server-side JavaScript code that is executed when an event it is listening to is triggered on the specified table. Just like any other server-side scriptscript actions have access to all the server-side glide APIs,script includes, and other server-side resources.

you can refer below link :

https://www.youtube.com/watch?v=Zo-KT9ASLYQ

https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/administer/platform-events/refere...

https://community.servicenow.com/community?id=community_question&sys_id=c71ccf25db9cdbc01dcaf3231f96...

https://subscription.packtpub.com/book/virtualization_and_cloud/9781787128712/10/ch10lvl1sec51/scrip...

after going throw this please mark it as correct/helpfull.

Thankyou.

 

Priyanka Pednek
Kilo Guru

 Hi keen

Script actions are used to execute any server side scripts asynchronously when an event is triggered. Here are 2 use cases that I can think

1) While performing integrations and you need to send large amount of data/records or attachments to an external system, it cannot be done synchronously as it will affect user experience. In such a scenario, you can call an event from a business rule and trigger the required script in the script action.

2) Suppose you have 200 child incidents tagged to an incident and you need to close all the child incidents when parent is closed. If you follow the Out of box approach, it will create system performance issues as the business rule is executed synchronously. In such a case you can call an event and execute the code for closing 200 child incident in a script action.

check this posthttps://community.servicenow.com/community?id=community_question&sys_id=8131ffa5db269f405ed4a851ca96...

also https://subscription.packtpub.com/book/virtualization_and_cloud/9781787128712/10/ch10lvl1sec51/scrip...

 Thanks

Please Hit like, Helpful or Correct depending on the impact of the response

Alikutty A
Tera Sage

Hi,

Script actions are triggered by events and execute server side scripts. You can execute any scripts asynchronously by calling out an event which is linked to a script action. If you need to update or process large number of records, the same can be executed in a script action.

Piyush Chaudhar
Kilo Expert

Hi Keen,

Script actions contain scripts which run when an event occurs like,
- Approval is cancelled
- Change is approved
- Problem is assigned etc.

It can have a condition which must be true for the script to run. These are commonly used to call a script include.

Please go through the link below for more information.
https://community.servicenow.com/community?id=community_question&sys_id=c71ccf25db9cdbc01dcaf3231f96...

Please mark it helpful/correct if you find it appropriate.

 

Thanks,
Piyush C.
find_real_file.png