- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2020 03:43 AM
How to fetch display values from catalog items in a client script? I have a requirement where I have to find all the catalog item variables inside a catalog and send them to endPoint for whatever the values that users enter in the form before the form is submitted.
I extracted all variables for the current catalog and I was able to get the values but for reference/choice fields its returning sys_ids and internal value.
How can I achieve this? I want to send the display values, not sys_ids.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-25-2020 04:00 AM
Hi,
it would work on native
can you try this
g_form.getDisplayValue('variableName')
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
‎09-25-2020 04:10 AM
Try this updated Script
1) Ensure Isolate Script field is set to false for your client script
2) This field is not on form but from list you can make it false
Example: my variable is reference to sys_user table
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if(window == null){
var valuePortal = g_form.getDisplayValue('requester');
alert('Portal->' + valuePortal);
}
else{
var valueNative = g_form.getDisplayBox('requester').value;
alert('Native->' + valueNative);
}
//Type appropriate comment here, and begin script below
}
Output:
Native:
Portal:
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader