- 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 06:42 PM
I would use GlideAjax. Even though getReference might work for you in the beginning, and very well could be quick- the issue begins when bad practice overtime builds up.
Regards,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2015 06:49 PM
Spot on.
When your instance is 2+ years old, you'll find performance degrades substantially.
Seen so many customers with years of bad practice resulting in almost unusable systems.
Food for thought:
For the use case of 'Get data from reference field and put in another field' I wrote a re-usable UI Script, putting a GlideAjax call down to 1 LOC.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2017 08:59 AM
Sorry for necroing a 2 year old thread, but I'm interested in the reusable script that you developed. Does it take into account any of the different data types available?
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2017 07:16 PM
It doesn't do any data type validation, you just input the fields you want to map based on a reference field and it will go and retrieve them.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2017 09:49 AM
hey thanks to everyone for chiming in on this thread. Seems like there is a pretty consistent opinion that GlideAjax is much preferred to getReference for many reasons.
great info!