Types of Scripting in ServiceNow

 

Types of Scripting in ServiceNow

ServiceNow has two types of scripting:

  • client-side scripting
  • server-side scripting

Client-side scripting

On the one hand, client-side scripts are running/executed in the browser. This means that the browser serves some type of functionality that executes or runs on the client side. This type of scripting is called client-side scripting. But what functionality does the browser exactly serve? When we are interacting with just about anything, whether we’re working in ServiceNow, making an airline reservation, or even checking the balance of a bank account, the browser renders the information to us that is handed off from the application server. So, the things you’re able to do on the client side is modify that interaction with the data you’re receiving.

For instance, UI Policy, UI Action, etc. requires client-side scripting.

A concrete example of client-side scripting in SN: is to populate/hide a field (description) based on the condition that the (incident) category is Hardware.

Server-side scripting

On the other hand, server-side logic takes place after interacting with that data and when it is sent back to the application server or database. Or even when interacting with data through an integration, such as an import set. That is all done on the server side.

For instance, business rules, script includes, ACLs, etc. require or involve server-side scripting.

A concrete example of server-side scripting in SN: is to populate caller on the form. This means that the system has to query the sys_user table so that it can pick the data from there and display it on the form.

How do you know when you have to use client-side or server-side scripting?

Everything related to cosmetic changes on the form is considered client-side scripting.

When the requirement is to get/query the data that is not displayed on the form, then you'll be using server-side scripting.


Comments

Popular Posts