- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2023 03:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2023 10:30 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2023 05:33 AM - edited ‎09-18-2023 05:42 AM
Hi @AkPatilakshay There are like 3 ways to fetch data from Server side to Client side:
Glide Ajax
The GlideAjax class allows the execution of server-side code from the client. GlideAjax calls pass parameters to the script includes, and, using naming conventions, allows the use of these parameters.
https://docs.servicenow.com/bundle/vancouver-api-reference/page/script/ajax/topic/p_AJAX.html
Get Reference
you can use the getReference() to glide that particular record from client side and access the related record of that Glide Object, you can find the more details here: GlideForm - Client
https://www.servicenowguru.com/scripting/client-scripts-scripting/gform-getreference-callback/
g_scratchpad
The g_scratchpad object passes information from the server to the client, such as when the client requires information not available on the form. For example, if you have a client script that needs to access the field u_retrieve, and the field is not on the form, the data is not available to the client script. A typical solution to this situation is to place the field on the form and then always hide it with a client script or UI policy. While this solution may be faster to configure, it is slower to execute.
You can have detail explanation for every method in the below video:
https://www.youtube.com/watch?v=LclUuP-gSN
Thanks & Regards,
Eswar Chappa
Mark my answer correct and Helpful if this helps you 😀
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2023 05:34 AM
Hi @AkPatilakshay ,
There are 3 different ways with which we can access server side data in client script.
1. Using getReference method
2. Using GlideAjax
3. Using display BR.
Mark my answer as accepted solution and helpful if helps you.
Thanks,
Nivedita Patil.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2023 05:39 AM - edited ‎09-18-2023 05:48 AM
Hi @AkPatilakshay,
Client Side - These run when form loads or any field changes on the client(web browser)
Server side - These run when user does interaction and updates or inserts or deletes record.
Server scripts run on the server or database.
There are 3 different ways with which we can access server side data in client script.
1. Using getReference method.
2. Using GlideAjax.
3. Using display BR.(g_scratchpad)
Note : We can also use GlideRecord API in client script directly but this is not recommended by ServiceNow. This also impacts health scan report.
Please refer the below link if it helps.
Please mark this answer as correct and helpful if it solves your issue.
Regards,
Siva Jyothi M.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2023 10:30 PM
1) getReference
2) GlideAjax
3) Display Business Rule