- 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 08:17 AM
in my catalog item i have both variable,1. normal variables 2. MRVS so how can the above code work for both?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2023 10:45 AM
@sinu2 You can use your code along with this one to get Both variables data as text.
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2024 06:16 AM
Hi @AnveshKumar M
I want to populate MVRS variable value in description. Did code worked ?