ServiceNow JavaScript Tutorial | Learn ServiceNow Scripting Free

 This article will help you to start your journey to learn ServiceNow JavaScript fundamentals from scratch with examples. If you are looking to this tutorial article it means that you are a ServiceNow developer or ServiceNow administrator or you are looking to be a ServiceNow development professional. We have designed this ServiceNow JavaScript tutorial in such a way that step by step all the concepts will be clear to you. We have shared the video link below through which it will help you understand the same practically.,

When to script in ServiceNow?

In ServiceNow, we do platform scripting which means by using JavaScript we can do some complex configuration and behavior in ServiceNow platform, and we have to make sure while scripting that we should follow best practices suggested by ServiceNow. Below is when we have to write the script:
  • Requirement to add new functionality.
  • Extend existing functionality.
  • When we have to make some changes in existing functionality
  • Automate Processes
  • To interact with Third party application (Integration – Scripted REST API etc)

Where does script execute?


Client-side scripts have access to data on forms and in lists.
Client-side scripts can be written in: Client Script, UI scripts, UI policies etc. For e.g.
  • To show/hide fields, make field mandatory, show/hide form sections.
  • Auto populate a field based on value of another field.
Very basic example:

alert("First basic script to get execute at browser");


Server-side scripts have access to database records.
Server-side scripts can be written in: Business rule, Script include Script action etc. For e.g.
  • Trigger a flow.
  • Modify a database record.
Example of Server-Side Script:

var gr=new GlideRecord('incident');
gr.addActiveQuery();  //Adds a filter to return active records.



Integrate to a third-party application.

Who Can Script?

System Administrator – User with admin role who manages all the features, application and data in the platform. (Role: admin)

System Definition Administrator – It’s a more granular administrative roles who manages a specific system definition. Like rights to edit only business rule or client script etc. (Role: script_include_admin, ui_policy_admin, client_script_admin etc.)

Application Administrator – Manages all the features and data of any application. Custom admin role to an administrator who maintain that application for e.g., HR Records etc.

Below is the Video Link which will help you to understand the concepts practically.

I believe all the information shared above will be helpful for you to understand ServiceNow JavaScript concepts and helps you to do scripting following best practices suggested by ServiceNow. We have posted remaining ServiceNow JavaScript Tutorial in this website; you can directly click on the Heading links given in Table of Content. Please provide your feedback, questions and suggestion in the comment box below. We will be happy with your feedback and suggestion given to us and will reply to your questions asked.

Post a Comment