MRVS variables not populating in RITM description

sinu2
Tera Expert

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;
1 ACCEPTED SOLUTION

AnveshKumar M
Tera Sage
Tera Sage

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 👍✔️

Thanks,
Anvesh

View solution in original post

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

@sinu2 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

I need to print both normal variables and MRVS variables in same ritm desc

AnveshKumar M
Tera Sage
Tera Sage

Hi @sinu2 

MRVS values are stored in the table sc_multi_row_question_answer , try querying this table according to your needs.

Thanks,
Anvesh

AnveshKumar M
Tera Sage
Tera Sage

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 👍✔️

Thanks,
Anvesh