getReference with callback vs GlideAjax?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-17-2017 09:55 PM
Solve a debate we're having....
SN recommends to always use GlideAjax for server side calls from a client. Which makes total sense for calling methods or getting results that might be complicated. But for simple record look ups, is getReference with a callback (thus making it async) any different than GlideAjax? getReference with a callback is less code...is there any real performance hit in this scenario?
example use cases:
1) getting a company record of a user (dynamically set by the end user and thus not something you can set on scratchpad) to display info about a company...or any other case where the end user dynamically sets a field and you need additional information to be displayed. Seems like getRef with a callback would be less code to achieve the same results
2) If you have multiple fields that that come from multiple tables, it would seem glideajax wins as you just make one call instead of multiple getReferences.
Does that about sum it up?
- Labels:
-
Best Practices

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-17-2017 11:34 PM
Hi Adam,
by using call back function we can dot walk into one level eg: if i want to dot walk to get caller manager phone number then it will not work so in this case you must be use either glide ajax for display business rule. but one point i would like to mention here display business rule works only when we reload the form it will not work in onChange() client script ("client data must be travel to server to get the information, so it will travel when page will reload).
by the way i would recommend you to refer the link below. and go through the 2nd and 3rd point.
https://snprotips.com/blog/2016/2/6/gliderecord-client-side-vs-server-side
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2017 12:34 AM
It's not about less code, it's about performance on the client.
If you're using getReference you will get ALL data for each record you "get" whether you need it or not.
If you're using GlideAjax you only get what you need, because you will explicitly return the exact information you need and nothing else.
Makes sense if you think about it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2017 04:15 AM
I recently did some performance testing on this exact topic and I found that GlideAjax performed about 15% faster than getReference.
While this doesn't sound like much, small performance gains like this become very important as your instance scales.