Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

how to use getreference field in client scripts to fetch the sysid of a particular reference field

mark125
Kilo Contributor

please help me

1 ACCEPTED SOLUTION

AbdulAzeez
Mega Guru

Malay,

 

You doesnt require to use getReference just to fetch the sys_id of the reference field you can do it by using 

 

var caller = g_form.getValue('caller_id'); // Gets the sys id of the caller

 

How ever if you want to know how to fetch using getReference here is the code:

 

var caller = g_form.getReference('caller_id'); // Gets the sys id of the caller 

 

Note: Good to try on onChange Client Script on Field Caller in incident table

 

 

Mark Correct / Helpful based on the impact of the answer.

Abdul Azeez

 

View solution in original post

3 REPLIES 3

SanjivMeher
Mega Patron
Mega Patron

You dont need getReference.

just use g_form.getValue('field_name');


Please mark this response as correct or helpful if it assisted you with your question.

AbdulAzeez
Mega Guru

Malay,

 

You doesnt require to use getReference just to fetch the sys_id of the reference field you can do it by using 

 

var caller = g_form.getValue('caller_id'); // Gets the sys id of the caller

 

How ever if you want to know how to fetch using getReference here is the code:

 

var caller = g_form.getReference('caller_id'); // Gets the sys id of the caller 

 

Note: Good to try on onChange Client Script on Field Caller in incident table

 

 

Mark Correct / Helpful based on the impact of the answer.

Abdul Azeez

 

mark125
Kilo Contributor

thanks bro