How to get value of dot walking field in client script?

Shivam7
Tera Contributor

How to get value of dot walking field in client script?

14 REPLIES 14

Darshani Sambar
Giga Contributor

Hi Shivam,

 

You can use OnChange client script.

Try below script.

 


var caller=g_form.getReference('caller_id',test);
function test(caller)
{
g_form.setValue('u_email',caller.email);
}

 

Please mark it as helpful/correct based on impact.
--


Regards

Darshani Sambare

Dhananjay Pawar
Kilo Sage

Hi,

In client script using getReference() you can do single dot walking, if you want multiple dot walking in client script use GlideAjax in client script.

 

Thanks,

Dhananjay.

Community Alums
Not applicable

Upload one example plss.

The SN Nerd
Giga Sage
Giga Sage

I wrote a Share App to do this with 1 LOC while adhering to Client Script Best Practice (which getReference() does not do, you can simply see by watching the console log)

SmartAjax - Write GlideAjax Data Lookups in 1 L.O.C.


ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

shitanshu2
Tera Contributor

To dot walk through client script use -

g_form.getReference(referenceFieldName).otherFieldValue;

 

Example-

if(g_form.getReference('requested_by').sys_domain=="09ff3d105f231000b12e3572f2b4775d")
 

Please mark correct and helpful.


Regards,
Sitanshu Gautam