- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2023 06:29 AM
Hi,
I have business rule where it is populating catalog item variables in RITM description.
It is working for all catalog items variables except Multi Row variable set
multi row variables are not populating in RITM descripton
Please find below code
var wn = '';
var varown = new GlideRecord('sc_item_option_mtom');
varown.addQuery('request_item', current.sys_id.toString());
//varown.applyEncodedQuery('ORDERBYsc_item_option.order');
varown.orderBy("sc_item_option.item_option_new.order");
varown.addQuery('sc_item_option.value', '!=', ''); //filter out null values
varown.addQuery('sc_item_option.value', '!=', 'false'); //filter out false values
varown.query();
while (varown.next()) {
var question = GlideappQuestion.getQuestion(varown.sc_item_option.item_option_new);
question.setValue(varown.sc_item_option.value);
if (question.getLabel() != '' && question.getDisplayValue() != '') { //only return questions and answers that are not empty
//wn += '\n' + question.getLabel() + ': ' + question.getDisplayValue(); //disabled this code. Dublin was having a problem; used the code below; the line break at end fixed the issue.
wn += question.getLabel() + ': ' + question.getDisplayValue() + '\r\n';
}
}
current.description = wn;
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2023 07:49 AM
Hi @sinu2
You can use the following code to get the MRVS values as description.
var mrvs_desc = '';
var varMRVS = new GlideRecord('sc_multi_row_question_answer');
varMRVS.addQuery('parent_id', current.sys_id.toString());
varMRVS.orderBy("row_index");
varMRVS.query();
while (varMRVS.next()) {
var question = varMRVS.getDisplayValue('item_option_new');
var answer = varMRVS.getValue('value');
if (question != '' && answer != '') {
mrvs_desc += question + ': ' + answer + '\r\n';
}
}
//Variable mrvs_desc will contain your description for MRVS variables
Please mark my answer helpful and accept as solution if it helped you 👍✔️
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2023 07:36 AM
you need to handle it separately.
you need to parse the MRVS and then print it
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
09-25-2023 08:16 AM
I need to print both normal variables and MRVS variables in same ritm desc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2023 07:41 AM
Hi @sinu2
MRVS values are stored in the table sc_multi_row_question_answer , try querying this table according to your needs.
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2023 07:49 AM
Hi @sinu2
You can use the following code to get the MRVS values as description.
var mrvs_desc = '';
var varMRVS = new GlideRecord('sc_multi_row_question_answer');
varMRVS.addQuery('parent_id', current.sys_id.toString());
varMRVS.orderBy("row_index");
varMRVS.query();
while (varMRVS.next()) {
var question = varMRVS.getDisplayValue('item_option_new');
var answer = varMRVS.getValue('value');
if (question != '' && answer != '') {
mrvs_desc += question + ': ' + answer + '\r\n';
}
}
//Variable mrvs_desc will contain your description for MRVS variables
Please mark my answer helpful and accept as solution if it helped you 👍✔️
Anvesh