- 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 03:47 AM
Hi,
try this
g_form.getDisplayBox('variable').value;
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 03:54 AM
It's giving java script error in the browser on the Service Portal.
- 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:04 AM
Hello,
Try the getReference with callback function.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
g_form.getReference('reference_for', doAlert); // doAlert is our callback function
function doAlert(reference_for) {
alert('User: ' + reference_for.name);
}
}
Thanks,
Sagar Pagar