How to Display Multi Row Variable set (MRVS) data in a notification

sinumohan531
Kilo Explorer

Notifcation wrtitten on sys approver table and  i am  using an Email script used :

template.print("Summary :<br />");
var item = new GlideRecord("sc_req_item");
item.addQuery("sys_id", current.sysapproval);
item.query();
while(item.next()) {
template.print(item.number + ": " + item.quantity + " X " + item.cat_item.getDisplayValue() + "<br />");
template.print(" Options:<br />");
var keys = [];
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(item.sys_id);
set.load();
var vs = set.getFlatQuestions();
for (var i=0; i < vs.size(); i++) {
if(vs.get(i).getLabel() != '' && vs.get(i).getDisplayValue() != '') {
template.space(4);
template.print(' ' + vs.get(i).getLabel() + " = " + vs.get(i).getDisplayValue() + "<br />");
}
}
}

But in the notification the multi row variables are are not showing .

The multi row variable in form is shown below :

find_real_file.png

3 REPLIES 3

Saurabh Gupta
Kilo Patron
Kilo Patron

Hi,

You should write a mail script for the same.

var mv=current.variables.mvrs;
for(var i=0;i<mv.getRowCount();i++)
{
mv.getRow(i).your_variable_of_mvrs)//your_variable_of_mvrs

}


If my answer replied your question please mark appropriate response as correct so that the question will appear as resolved for other users who may have a similar question in the future.

Regards,
Saurabh


Thanks and Regards,

Saurabh Gupta

I need to write a general email script to get all the MRVs . 

The notification is triggered is for all other RITMS as well.

Mark Roethof
Tera Patron
Tera Patron

Hi there,

See this article which I wrote a few months ago. It can help you creating a nice summary for your notification.
Creating records or a summary from Multi-Row Variable Set (2)

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

Kind regards,
Mark
2020, 2021 ServiceNow Community MVP
2020, 2021 ServiceNow Developer MVP

---

LinkedIn
Community article, blog, video list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

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

LinkedIn