What is the use of getReference()?

ishankaggarwal
Tera Contributor

What is the use of getReference()?

16 REPLIES 16

pranita-24
Tera Guru

Hi @ishankaggarwal 

getReference() is used to fetch the full GlideRecord of a reference field.

For example, if you have a reference field like Caller (caller_id) on an Incident:

  • g_form.getValue('caller_id') → only returns the sys_id.

  • g_form.getReference('caller_id', function(caller) { ... }) → returns the full user record so you can access fields like caller.name, caller.email, etc.

This is useful when you need additional details of the referenced record in client scripts.

Please hit like and mark my response as correct if that helps
Regards,
Pranita D
 
 
 
 
 
 

pranita-24
Tera Guru

Hi @ishankaggarwal 

getReference() is used to fetch the full GlideRecord of a reference field.

For example, if you have a reference field like Caller (caller_id) on an Incident:

  • g_form.getValue('caller_id') → only returns the sys_id.

  • g_form.getReference('caller_id', function(caller) { ... }) → returns the full user record so you can access fields like caller.name, caller.email, etc.

This is useful when you need additional details of the referenced record in client scripts.