- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2020 08:58 AM
Hello,
Sorry for the elementary question.
I'm studying servicenow, and also learning about development and mechanics.
My question:
Why does servicenow write the processing separately with client script and script include (server)?
For example, in SAP, everything is written on the server side, including screen control and check processing.
What is the meaning and advantage of writing the processing separately?
We believe that understanding this mechanism will help you code efficiently in the right places.
Regards,
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2020 10:01 AM
Please Mark Correct and Helpful
Thanks and Regards
Gaurav Shirsat

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2020 09:38 AM
Hi Mi
I am happy that my information is useful in your work.
all the best.keep exploring
Please Mark Correct and Helpful
Thanks and Regards
Gaurav Shirsat

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2020 09:42 AM
Hey Mi,
Client Script:
Client scripts allow the system to run JavaScript on the client (web browser) when client-based events occur, such as when a form loads, after form submission, or when a field changes value.
Use client scripts to configure forms, form fields, and field values while the user is using the form. Client scripts can:
- make fields hidden or visible
- make fields read only or writable
- make fields optional or mandatory based on the user's role
- set the value in one field based on the value in other fields
- modify the options in a choice list based on a user's role
- display messages based on a value in a field
Client Scripts are basically used to execute on the Front End. On the browser.
Script Include:
Script includes are used to store JavaScript that runs on the server.
Create script includes to store JavaScript functions and classes for use by server scripts. Each script include defines either an object class or a function.
Consider using script includes instead of global business rules because script includes are only loaded on request.
Script Includes are triggered by Server side API's only. Like Business Rule, UI actions etc. It doesn't have a triggering point of It's own. It triggers where it is called.
Script Include are helpful for back end operations but client script is helpful for Front end operations
Script Include are basically just containers of JavaScripts.
If you like my answer then please mark it Correct and Helpful.
Thanks and Regards:
Utpal Dutta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2020 06:54 PM
Hi,
Thank you for information.
I understood a little, so I think I have to study more.
Regards,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2020 11:33 AM
Hi,
In addition to above valuable inputs most important I guess would be option of Script include. Since, you know Script include (runs server side) it is like writing once & using 'n' number of times. So, you have written a server side code & you are using it 'n' number of times at different places (client scripts using GlideAjax, in reports, reference qualifers by using javascript: scriptinclude().function()).
If you have to write same at Server side it would have to be different for different options as there would definitely be a need to pass variables specific to the item that actually nees script to be called. This being one of & there may be many like performance since it involves client side few of things like session, logged in user details can be use to make things work at client side rather than going to server & then displaying in turn performance impact is low as data may be retrieved on the fly within milli or nano seconds.
There are many advantages & also disadvantages as with good comes bad as well. Refer link for more detailed information with suitable examples.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2020 06:52 PM
Hi,
Thank you for additional comment.
I'll refer to link by you.
Regards,