- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā12-11-2020 12:04 AM
Hi ,
I have a client script on the catalog form . There is a field called 'division' in the form which should autopopulate the value of 'division' field also present in the user table according to the requested for. I have a script include where i have fetched the values from user table and i have called the script include from client script . The problem is now i get a sysid instead of display value . Even if i use toString() or getDisplayValue still it gives me the sysid instead of displayvalue .
Here is the line of code in script include:
result.setAttribute('division', gr.u_division);
where gr is the glideRecord of sys_user table and the division field in the user table is a reference field refering to division table .
Client script:
.
.
ga.getXML(employeeInfo);
function employeeInfo(serverResponse) {
var result = serverResponse.responseXML.getElementsByTagName("result");
var div = result[0].getAttribute("division");
g_form.setValue("division",div );
}
Any leads on this is highly appreciated
Regards,
Naresh
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā12-11-2020 12:30 AM
Hi,
You can get the display value of reference field in the script include function
result.setAttribute('division', gr.u_division.getDisplayValue());
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā12-11-2020 12:51 AM
Hi,
yes in client script you can get display value of reference field like this
var value = g_form.getDisplayBox('fieldName').value;
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader