- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2024 03:07 AM
Hello Community,
I want to know whether getReference is good approach or GlideAjax and why?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2024 03:09 AM
@a41022639 GlideAjax is any day better than getReference as GlideAjax offers a lot of flexibility than getReference and GlideAjax is also more performant than getReference. Refer to this https://grow.usecoda.com/avoid-using-gform-getreference to know why getReference should be avoided.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2024 03:11 AM
Hello @a41022639 ,
Both helps you to bring the server-side data to client side, but the most preferred way to do it with the help of GlideAjax instead of getRefference, just because getRefference might lead to the performance issue because it searches for every field in the form whereas GlideAjax is gives you the exact value without taking too much time because it directly focuses on requested field data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2024 03:13 AM
If you face any difficulty while writing the code, you can reach out to me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2024 03:14 AM
GlideAjax is always better. With callback of course.
Main difference would be that Get Refence will bring the whole object but using GlideAjax you can decide what you need to send form server to Client, so its more lightweight and potentially quicker.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2024 03:21 AM
Hi @a41022639,
The choice between `getReference` and `GlideAjax` in ServiceNow depends on your specific use case.
- `getReference` is typically used to fetch reference fields from records. It's synchronous and ideal for straightforward data retrieval.
- `GlideAjax` is more versatile, allowing asynchronous server-side scripting and data manipulation. It's useful for more complex interactions, like triggering server-side scripts or performing operations that involve multiple steps.
So, if you need a simple, synchronous data retrieval, `getReference` might be sufficient. But for more complex operations or asynchronous requests, `GlideAjax` is the way to go.
Please accept my solution if it resolves your issue and thumps 👍 up
Thanks
Jitendra