- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Scripts in ServiceNow fall into two categories:
- Client-side
- Server-side
Client-side scripts execute within a user's browser and are used to manage forms and form fields. A Client Script executes client-side script logic when forms are:
- Loaded
- Changed
- Submitted
There are lots of community articles / blogs / discussions written by experts, speaking about the types of client script, examples of client scripts. In this article you will learn more about Client Scripts which are basics of any client scripts but are mostly not given a thought before writing any script. Below are the some of the points:
Inherited (checkbox)
Developers have been doing client-side coding with client scripts since years depending on the backend implementations. One of the major actions is extending the OOB or custom tables. And then the question comes, do I need to re-write the client scripts for the child or extended table again?
Well, here comes this feature and the Inherited field. For example, you have created a custom table by extending the OOB or older custom table. You now want to have same client behaviours; you don’t need to worry about re-writing the scripts again. Re-visit the existing client script and update the Inherited field to true.
Global (checkbox)
Working with the tables and its views have always been a headache for the new bees. Most of the times business ask is creating multiple views for a table and making it visible based on the roles. This implies the client interactions as well. For example, your table / form can have multiple views and the client interactions / behaviours can differ based on the views.
There comes the Global checkbox which states whether the client script applies globally on all views of the table or not. So, if true, the client script runs on all views of the table. If not, form shows up with one more field ‘View’ asking about the view name for which the client script would be applied.
Isolate script (checkbox)
Client-side coding is sometimes a complex part and may include windows objects, jQuery, prototype, and DOM manipulations. By default, new client scripts are run in strict mode, with all these things disabled. If you script needs to make use of either DOM or prototype / windows objects, you need to isolate the script so that the system allows it for your script.
More details: - Isolate Script in London
Thank You!
Regards,
Kailash Bhange,
Rising | LinkedIn
- 6,292 Views
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.