GlideObject availability in Client Script

georgechen
Kilo Guru

Hi folks,

Is it possible to incoporate Glide Object into Client Script?     I know there might be a ScriptInclude that can be called by client script, however, this adds up the complicty of client script to declare ClientScript Ajax.

The idea was to implmement a GlideObject into a client script so as to fetch a order guide (requested item) to prepopulate the field value back to a order guide form.

Any input would be appreciated.

Kind regards,

4 REPLIES 4

ghsrikanth
Tera Guru

Yes, GlideRecord is available in Client side scripting - but the APIs are very few and dot-walking is not possible for that you have to again query using getReference logic


Client Side GlideRecord - ServiceNow Wiki



Its preferable to code in GlideAjax and you can separate all the code to server side and the script include will just return the result.



Mark if it is correct or helpful, feedback is appreciated


Thanks Srikanth, GlideReocrd is table based, as the query involes three tables, so perhaps GlideAjax is the way to go.



Your prompt response is much appreciated!


If you are trying query three tables then its better to go for GlideAjax


GlideAjax - ServiceNow Wiki



If the answer has helped to resolve, please mark it as correct, so that it will help future users of community


The problem with GlideObject on Client Scripts is two-fold. First, it hangs the page with what essentially amounts to a getXMLWait() method, which can make for a very buggy feel for the end user. Second, it pulls back the entire record rather than the few fields you actually need, causing a longer wait time that circles back to the first problem.



I've used both GlideRecord and GlideAjax in client scripts, and GlideAjax is an infinitely better approach in 99% of cases. It's more work up front, but it causes significantly less strain on the system and less headache for your end users.