- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2019 06:29 PM
Hi,
can anyone please explain script include how it will work. and explain one scenario where we can use this with scripting. please please don't send me links. i have tired to check with links but not able to understand. explain one scenario and from where we can call.
Regards,
Sasi.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2019 07:25 PM
Hi Sasi,
A script include is simply a place to store some reusable JavaScript code that you would like to use usually more than once / in multiple places. If you have ever found yourself writing some JavaScript code in a Business Rule or a Client Script more than once for example, you could instead create a script include and call that script include when required from the Business Rule or the Client Script.
Out of the box there are over 1400 Script Includes included in the Madrid Release of ServiceNow that you can review by navigating to System Definition > Script Includes.
In regards to other scenarios where you may use this functionality, consider a scenario where several of your catalog items may require the same functionality (e.g. populating specific employee data automatically when an employee is selected). Rather than scripting this functionality for each catalog item in a Catalog Client Script you could do it once in a Script Include which you could call from your Catalog Client Script for each Catalog Item. By doing this, you are reducing the risk of introducing errors and if you need to update any functionality you can do it once in a single place in the Script Include rather than individually in each Catalog Client Script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2020 12:10 AM
Check out this video, it will clear all your doubts and help you to understand Script Include And Ajax Call queries in details.
Link: https://www.youtube.com/watch?v=qNiYWMMzC2o&t=209s&ab_channel=ServiceNowHelpdesk
It help you to understand below points.
- Understand Script Include And Ajax Call
- When, How and in which scenario we will use it.
- Understand Synchronous (getXMLWait()) and aSysnchronous (getXML()) Ajax call and scenario based use of it.
Please mark reply as Helpful/Correct, if applicable. Thanks!!