- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023 10:17 PM
Hi,
Is there a way I can define in the Flow designer, to display the variable label and filled in values on the RITM Description field for the catalog item being requested
I created a RITM Update record action in the flow to update the Description where it gives me option to select values using data pill and also shows a script option.
I have written the below script which return the variable values as comma separated.
However I am not able return the variable label and display it in line break format
------------
Solved! Go to Solution.
- Labels:
-
Request Management
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023 11:17 PM
Glad to know.
Yes you can but for that you need to enhance the script and check if the value is not false
something like this
var ritmSysId = fd_data.trigger.ritm.sys_id;
var ritm = new GlideRecord('sc_req_item');
ritm.get(ritmSysId);
var arr = [];
var variables = ritm.variables.getElements();
for (var i=0;i<variables.length;i++) {
var question = variables[i].getQuestion();
var label = question.getLabel();
var value = question.getDisplayValue();
if(label != '' && value != '' && value != 'false'){
arr.push(label + " - " + value);
}
}
return arr.join('\n');
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023 10:27 PM
update as this
var ritmSysId = fd_data.trigger.ritm.sys_id;
var ritm = new GlideRecord('sc_req_item');
ritm.get(ritmSysId);
var arr = [];
var variables = ritm.variables.getElements();
for (var i=0;i<variables.length;i++) {
var question = variables[i].getQuestion();
var label = question.getLabel();
var value = question.getDisplayValue();
if(label != '' && value != ''){
arr.push(label + " - " + value);
}
}
return arr.join('\n');
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
05-23-2023 11:13 PM
@Ankur Bawiskar, Thanks you so much. It works as required.
Is there a way to not display the check box false variables in the RITM description?
Regards,
Somujit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023 11:17 PM
Glad to know.
Yes you can but for that you need to enhance the script and check if the value is not false
something like this
var ritmSysId = fd_data.trigger.ritm.sys_id;
var ritm = new GlideRecord('sc_req_item');
ritm.get(ritmSysId);
var arr = [];
var variables = ritm.variables.getElements();
for (var i=0;i<variables.length;i++) {
var question = variables[i].getQuestion();
var label = question.getLabel();
var value = question.getDisplayValue();
if(label != '' && value != '' && value != 'false'){
arr.push(label + " - " + value);
}
}
return arr.join('\n');
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023 11:24 PM
My bad..i was doing it as || value != 'false' instead of &&.
Thanks again!