why it is not good to use GlideRecord in clientscript?

Mohd Shahnawaz
Tera Contributor

why it is not good to use GlideRecord in clientscript?

1 ACCEPTED SOLUTION

Gowrisankar Sat
Tera Guru

Client scripting(which runs on browser) uses either data available on the form or data retrieved from the database.



Use client data as much as possible to eliminate the need for time-consuming server lookups i.e. GlideRecord.



The best ways to get data into form/browser from the database are g_scratchpad, and asynchronous GlideAjax lookup.


View solution in original post

2 REPLIES 2

Gowrisankar Sat
Tera Guru

Client scripting(which runs on browser) uses either data available on the form or data retrieved from the database.



Use client data as much as possible to eliminate the need for time-consuming server lookups i.e. GlideRecord.



The best ways to get data into form/browser from the database are g_scratchpad, and asynchronous GlideAjax lookup.


plaura
Tera Contributor

From wiki:


Minimize Server Lookups

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() callback 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. The GlideRecord API is not available for scoped applications.



https://developer.servicenow.com/app.do#!/document/content/app_store_doc_technical_best_practices_ja...