Using Glide record in client script

sowmyaj
Giga Expert

Hi All,

                  I heard that we should not use GlideRecord in client script/ UI page client script as it is not a good practice. May I know is this information is true. Is Geneva release restricting us to use GlideRecord in clientscript?

                  Please clarify me on this.

Thanks,

Sowmya.

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Sowmya,



Client scripting uses either data available on the client or data retrieved from the server. Use client data as much as possible to eliminate the need for time-consuming server lookups. The top ways to get information from the server are g_scratchpad, and asynchronous GlideAjax lookup.


The primary difference between these methods is that g_scratchpad is sent once when a form is loaded (information is pushed from the server to the client), whereas GlideAjax is dynamically triggered when the client requests information from the server.


Other methods, GlideRecord and g_form.getReference() are also available for retrieving server information. However, these methods are no longer recommended due to their performance impact. Both methods retrieve all fields in the requested GlideRecord when most cases only require one field.




P.S : GlideRecord is not supported at client side in scoped application. You have to use GlideAjax to retrieve information.


View solution in original post

4 REPLIES 4

Kalaiarasan Pus
Giga Sage

Gliderecord should not be used in client side scripting and can be easily replaced/remodeled using a script include + Glideajax.


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Sowmya,



Client scripting uses either data available on the client or data retrieved from the server. Use client data as much as possible to eliminate the need for time-consuming server lookups. The top ways to get information from the server are g_scratchpad, and asynchronous GlideAjax lookup.


The primary difference between these methods is that g_scratchpad is sent once when a form is loaded (information is pushed from the server to the client), whereas GlideAjax is dynamically triggered when the client requests information from the server.


Other methods, GlideRecord and g_form.getReference() are also available for retrieving server information. However, these methods are no longer recommended due to their performance impact. Both methods retrieve all fields in the requested GlideRecord when most cases only require one field.




P.S : GlideRecord is not supported at client side in scoped application. You have to use GlideAjax to retrieve information.


Hi Pradeep,



                            Thanks a lot for your detailed explanation. I'm clarified with my doubt.



Thanks,


Sowmya


faizan 71717
Kilo Explorer

Great.