- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2015 10:37 AM
I'm seeing in the Wiki, "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.". However in my Implementation Bootcamp book it has "getReference()" listed as a best practice when used with a callback function. I'm looking for clarification on this is specific reference to the Implementation Specialist exam, and whether the exam would follow the book or the Wiki. Or is it possible I'm not seeing this correctly. Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2015 11:34 AM
Hi Patrick,
g_form.getReference just ends up calling the client-side GlideRecord API. In my opinion, client-side GlideRecord should be avoided as much as possible, since it usually results in a lot of data being transferred needlessly. If you are going to use it, use a callback (g_form.getReference accepts a callback as the second parameter). Client-side GlideRecord can also take a callback (passed in to the query method).
If you are going to use client-side GlideRecord (either through getReference, or directly), do so with a callback so it's non-blocking. However, you rarely need to get the entire record back when doing lookups, so a GlideAjax script which can return only the necessary information is typically a better choice.
Thanks
Cory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2015 11:34 AM
Hi Patrick,
g_form.getReference just ends up calling the client-side GlideRecord API. In my opinion, client-side GlideRecord should be avoided as much as possible, since it usually results in a lot of data being transferred needlessly. If you are going to use it, use a callback (g_form.getReference accepts a callback as the second parameter). Client-side GlideRecord can also take a callback (passed in to the query method).
If you are going to use client-side GlideRecord (either through getReference, or directly), do so with a callback so it's non-blocking. However, you rarely need to get the entire record back when doing lookups, so a GlideAjax script which can return only the necessary information is typically a better choice.
Thanks
Cory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-22-2016 11:47 AM
My thoughts...GlideAjax is the better choice for this..however it is recognised to do an callback function within a CS and this is in their training material so I guess cant be a bad thing..however....doing the callback will flag up in ACE reports

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2015 11:36 AM
I think as long as you use a callback function and aren't doing multiple getReference() calls you're ok. I think if you have a requirement that's going to cause you to use multiple getReference() calls at once then you'll probably want to use GlideAjax.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2015 05:57 PM
At the end of the day, you've got the trade off of simplicity vs efficiency.
As you can see, getReference w/ callback give you the best balance of simplicity vs efficiency.
Client Script - Simplicity vs Efficiency
API | Simplicity | Efficiency | Description |
---|---|---|---|
GlideRecord getReference | 1st | 5th |
|
GlideRecord | 2nd | 4th |
|
GlideRecord getReference w/ callback | 3rd | 3rd |
|
GlideRecord w/ callback | 4th | 2nd |
|
GlideAjax | 5th | 1st |
|
Terms
L.O.C. - Lines of Code (Just estimates on the top of my head)
UX - User Experience
S.I. - Script Include
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022