Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

How to fetch reference field data in catalog client script or in script include

Ulka1
Tera Contributor

Hi Expertise,

I need to fetch reference field(like caller) data such as location which is stored in sys_user table and then I have to use this location in catalog client script. so please could anyone suggest me how to achieve this one. I tried getReference method but it is not working.

Awaiting for your response.

Thank You,

Ulka

 

 

 

22 REPLIES 22

var subjectPerson=g_form.getReference('subject_person',doAlert);

function doAlert(subjectPerson)

{

if(subjectPerson.getDisplayValue('location') =='XYZ')

{

g_form.setValue(field Name', 'field value');

}

Thanks,
Shakeel Shaik 🙂

HI Smudge,

i tried one also, not working. by this  code we are getting the location value as i checked it by adding addInfomessage statement. Undefined value is showing.

 

var subjectPerson=g_form.getReference('subject_person',doAlert);

function doAlert(subjectPerson)
{

if(subjectPerson.getDisplayValue('location') == 'XYZ')
{

g_form.setValue('field Name', subjectPerson.getValue('location'));
}

}
Thanks,
Shakeel Shaik 🙂

Hi,

try to use this

var subjectPerson = g_form.getReference('subject_person',doAlert);

function doAlert(subjectPerson)
{
	if(subjectPerson.location == 'locationSysId'){
		g_form.setValue('fieldName', subjectPerson.location);
	}
}

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur, let me clear my requirement,i have to first fetch the subject person's location(subject person is a reference field to sys_user table) and depending upon this location set other field value.