- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi All,
I want a fetch all the variable for the RITM request and i have used the REST scripted API but i am getting the sys_id for the some of the fields but i do not want sysid beacuse end user will not under stand, Can you advise how to get the value .
scripted API:https://p132uat.service-now.com/api/p1o32/ritm_vars_api/ritm
scripted API :
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
14 hours ago
yes I just checked if the displayValue() is present then pick that or else directly use the value
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
you will have to query the table being referred by that reference or list variable and then get display value
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
try to update as this, I just shared the small part and you can replace that in your main script.
I used getDisplayValue() to grab the display value for reference variable
for (variableName in ritmVariables) {
if (ritmVariables.hasOwnProperty(variableName) && ritmVariables[variableName]) {
variableName = variableName.toString();
// Get a GlideElement for the variable if possible
var variableValue = ritmVariables[variableName];
// If it's a GlideElement with getDisplayValue, use that; else use toString()
if (variableValue.getDisplayValue()) {
variablesObject[variableName] = variableValue.getDisplayValue();
} else {
variablesObject[variableName] = variableValue.toString();
}
}
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
14 hours ago
HI @Ankur Bawiskar ,
this line of code is correct :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
14 hours ago
yes I just checked if the displayValue() is present then pick that or else directly use the value
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader