Thursday, September 21, 2017

How Client Scripts works in Service Now ?

What is Client Script ?


Client scripts are shipped to the client (the browser) and run there instead of on the server. Users who know JavaScript can define scripts to run in the client browser. Several types of scripts are supported:

1. Scripts can run on the server, client and browser.
2. As Servers have direct access to database; server scripts are used to generate events.
3. Clients have direct access to forms; client scripts are used to make customization on forms.
4. Types of client scripts:
5. On load - This loads in the background when the form is clicked.
6. On Change: This runs when the user changes the value on the form.
7. On submit: this runs when the user submits the form. Used to validate the values that user added.
8. On celledit scripts: They are like on change. But except they run when the user changes values from the list view drop down.
9. Client scripts control the changes to the form by an API called Glideform.
10. The script calls the glide form API using g_form object.

G_user object is used to provide information about the current user.
G_user methods and properties :
- Makes calls to the database using the server without using the sql. This api uses the gr object.

- GlideAjax APi passes work to the server using scriptinclude.



Best practices of client scripts: 
1. We get a load of client scripts already in the system. So always keep a copy of the original before making any changes to it.
2. Client scripts take a bit time to load the data from server. So, use as less number of get.reference() functions to reduce the load on the server.
3. Write lengthy scripts on server side.
4. Call them using the script include.



4 comments:

  1. ServiceNow provides comprehensive lifecycle management of Amazon resources. Incorporate Amazon offerings into your enterprise service catalog, integrate AWS Config with the ServiceNow CMDB, and manage usage, costs of Amazon resources at the application, service and cost center levels. Implement efficient incident, problem and change management of services deployed through AWS CloudFormation.

    ReplyDelete
  2. the blog is about Save on CMS pages with dynamic iFrame loads it is useful for students and servicenow Developers for more updates on servicenow follow the link

    ServiceNow Online course Bangalore

    For more info on other technologies go with below links

    tableau online training hyderabad

    Python Online Training

    mulesoft Online Training


    ReplyDelete
  3. Thanks for sharing valuable information and very well explained. Keep posting.

    servicenow online training hyderabad
    servicenow admin training online

    ReplyDelete