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

HI @AnveshKumar M 

 

in my catalog item i have both variable,1. normal variables 2. MRVS so how can the above code work for both?

@sinu2 You can use your code along with this one to get Both variables data as text. 

Thanks,
Anvesh

v_26
Tera Contributor

Hi @AnveshKumar M 
I want to populate MVRS variable value in description. Did code worked ?