How to get the values of a column in MRVS?

dianemiro
Kilo Sage

Hi Everyone,

We are using an MRVS in one of our Catalog Item. Based on what the user entered on the MRVS, a task should be generated. Question is how can I check if a column e.g. TACAS has a true value in it. If so, a task should be generated. But when a column do not have true value, it won't generate anything. Any suggestions?

find_real_file.png

Thank you,
Diane

1 ACCEPTED SOLUTION

dianemiro
Kilo Sage

I was able to do this using an if script in the workflow. First I get the MRVS in RITM then store it on a variable. Now I will check if this variable contains 'true' then return yes else return no.

View solution in original post

3 REPLIES 3

Mark Roethof
Tera Patron
Tera Patron

Hi there,

How are you trying to generate a task? Upon submission of your catalog item, thru workflow, run script utility in the workflow? Or business rule? Etc.

If you would use current.variable.your_multi_row_variable_name, this will already provide you with the JSON of the MRVS. Also you could check the generated variables in the sc_multi_row_question_answer table.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

dianemiro
Kilo Sage

I was able to do this using an if script in the workflow. First I get the MRVS in RITM then store it on a variable. Now I will check if this variable contains 'true' then return yes else return no.

Shruti Tikhe
Tera Contributor

We can use this way instead of Glide 'sc_multi_row_question_answer' table .

Here  is my working script.

(function executeRule(current, previous /*null when async*/ ) {

var mrvs = current.variables.vendor_information; //variable set internal name
var totalRows = mrvs.getRowCount();
var total = 0;
for (var i = 0; i < totalRows; i++) {
total = total + mrvs.getRow(i).getCell('vendor_price').getCellDisplayValue() * mrvs.getRow(i).getCell('quantity').getCellDisplayValue(); //provide value of variable
}
var req = new GlideRecord('sc_request');
req.get(current.request);
req.price = total.toFixed(2);
current.price = total; //set value on request form
})(current, previous);