Client Script ServiceNow | Tutorial Client Side Scripting in ServiceNow

Article briefs in detail about all sections of Client Side Scripting in ServiceNow or Client Side Programming in ServiceNow. Article provides you complete understanding that from which development sections in ServiceNow you can write client side code and the brief of all the development sections has been given in this blog. 

servicenow client side programming,servicenow tutorial,servicenow training videos,client side programming servicenow


When we start doing coding or learn coding, then we always heard client-side programming and server-side programming. In this blog we only focus on client side scripting in ServiceNow and later in another blogs we will cover server-side scripting too 😃 . 

For server side programming ServiceNow tutorial, click below link:
Server Side Programming in ServiceNow
So, as per my understanding I am sharing client scripting types in ServiceNow and there overview in below article, I hope this would will help you understand require topics. 

In this ServiceNow client side programming article, below mentioned topics will be covered:
  • What is Client-Side scripting in ServiceNow or Client side programming in ServiceNow?
  • What are the different types of Client Side Scripts in ServiceNow?
  • Overview of all client side scripting areas mentioned in above point? 

What is ServiceNow Client Side programming or Client Side Scripting in ServiceNow?

Client-side script runs on the client machine or browser and deals with user interface. For e.g. create web form, create interactive web page, interact with local storage, send request to server etc.
Some of client-side scripting languages are java script, html, CSS, VBScript, ajax etc.


Example of task you can perform using client-side script in ServiceNow:
  • Make field mandatory
  • Make field read only
  • Make field hidden
  • Make field visible
  • Validate the form on submission
  • Display messages
  • Add more field dynamically
  • Add Values into dropdown dynamically
  • Add or remove some fields on form load

There are lots of other functionalities which we can implement client side using client-side scripting in ServiceNow.

What are the different types of client-side scripts in ServiceNow?

In ServiceNow there are various interfaces available to do client-side scripting and out of those interfaces some of them are used in client side and even server side scripting both. In ServiceNow types of client-side scripts are: 
  • Client Script
  • Catalog Client Script
  • UI Script
  • UI Policy Scripts
  • Catalog UI Policy Scripts
  • UI Pages
  • UI Actions
  • UI Macro

Form the above list in UI Pages, UI Macros and in UI Action we can also server-side scripting in servicenow.

Overview of all client-side scripting options mentioned in above point?

Below are the types of client side scripts used in servicenow:

Client Scripts in ServiceNow

In servicenow client scripts runs on client side. In servicenow there are four types of client scripts as mentioned in below image. Four types are onload, onchange, oncelledit and onsubmit client scripts. Actually, when we create client script and select type then this type basically tells that when we want to execute or run the client script. For e.g. If we select the type onload then it means that client script will run each and every time form gets load or render before and before gives any input in form. Such as onchange client script will run when user change the value of any field. etc. 

You can find below client script tutorial video and client script form screenshot.


client script servicenow, client side scripting in servicenow, servicenow client side scripting
ServiceNow Client Side Programming - Client Script



Catalog Client Script ServiceNow

We write catalog client script only for service catalog item, variables and variable set. This can be used such as if you want to make any field mandatory in service catalog, you want to validate the form submission, you want to hide any field or you want to show any field as per other field values etc. Catalog client script is almost same as above client script but with some important differences.

UI Script ServiceNow

This is the scripts which user creates and can reuse anywhere in client scripts, UI page, UI macro, client-side script objects and from html code etc. Let say we have created several methods in UI script. Then if we want to use those methods when we are writing the client script code, then we can call that method over there. Please find below screenshot for the same.

UI script servicenow, client side scripting in servicenow, servicenow client side scripting
ServiceNow Client Side Programming - UI Script

UI Policies in ServiceNow

UI policy script executes when UI Policy condition tests true or condition is tests false. This true and false condition is actually evaluated from the selected field in UI policy interface. For e.g. if name field contains admin then script written in true section will get execute and if not, then code written in false section will get execute. 

Please find below screenshot and video tutorial of ui policies in servicenow.


ui policies servicenow, client side scripting in servicenow, servicenow client side scripting
ServiceNow Client Side Programming - UI Policies



Catalog UI Policy Script Servicenow

It is almost same as mentioned in UI Policy Script above but the main difference is that it will only run or execute in service catalog item.


UI Pages in Servicenow

UI pages in servicenow can be used to create and display forms, dialogs, lists and other UI components. In UI pages we can write client-side script and service side script both. That depends on requirement that what code we have to write. Please find below screenshot for the same.

Demonstrate servicenow client side programming
ServiceNow Client Side Programming - UI Page

UI Action in ServiceNow

In UI action we can do client-side scripting and server-side scripting both. UI action is used to add form buttons, context menu, list choice, list link, list banner button etc. Please find the screenshot for the same. For UI action video tutorial, you can click below link:


ui action servicenow, client side scripting in servicenow, servicenow client side scripting
ServiceNow Client Side Programming - UI Action


UI Macro in ServiceNow

To create UI macro knowledge of jelly script is required and we can client side and code and server side calling from UI macro. 

Below is the screenshot and video tutorial of UI Macro in ServiceNow.


Demonstrate servicenow client side programming
ServiceNow Client Side Programming - UI Macro



We hope above all information will help you to understand client side scripting in ServiceNow. There are various section for client scripting in ServiceNow. In our YouTube channel Basico ServiceNow learning we have posted all practical implementation tutorial of UI action, UI Macros, UI pages, UI Policies, UI Scripts, Catalog Client Script etc. Please do share you feedback below and let us know if you required clarity or understanding in any of the topic related to client side scripting in ServiceNow. We will try our best to answer you all queries.

2 comments:

  1. Good content!

    ReplyDelete
  2. Thank you so much for sharing this article with us. This was very helpful. Looking forward to more content from you.

    ReplyDelete

Thankyou !!!!

Powered by Blogger.