- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2016 10:14 AM
I am having a requirement where i have to get the field values and show it in Catalog item when the requestingfor field is changed.
I wrote a client script and querying the data from User table for the user in requestingfor field.
How ever there is a field in User table called Location which is a reference field. I need to read that in my following script.
function onChange(control, oldValue, newValue, isLoading) {
var userRec = g_form.getReference('requestingfor', getTermedRec);
function getTermedRec(userRec){
if(!isLoading && newValue != oldValue){
g_form.setValue('req_', userRec.title);
g_form.setValue('requester_email', userRec.mobile);
* i need to get the value of location which is a reference field in User table. Where as above two fields were single line text field.
I cannot do g_form.setValue('requester_location', userRec.location); its not working.
}
}
}
Can anyone please help me get the script to read the display value, Let me know if you need additional info to assist.
Thanks,
Nanda
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2016 10:38 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2016 10:24 AM
Ahh.. Then you cannot use getReference() in your use case. getReference() will only work for one level dot walking. You cannot dot walk into the location table and get name here. So, your only option is to use GlideAjax. Let me know if you need help in scripting?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2016 10:28 AM
Use this thread for reference and let me know if you are blocked.
Return multiple values from Glide Ajax
Split an Array from GlideAjax on the Client Side

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2016 10:34 AM
I believe you should be changing the location to reference type instead of string. This will give the user option to view related details too if needed else he/she may just can see the display value itself.
This will also make it easier for you to set the location value with just a getreference instead of doing a Glideajax for the same.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2016 10:36 AM
Hi Kalai,
I will change this to reference field.
Can you use my above script and add the lines which i need to get the value of location.
Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2016 10:38 AM
Your current script should work, if you change it to reference type.