Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

unable to insert mvrs data into email notification

kam4
Tera Contributor

Hi Al,

I have an issue where i have create an email notification and try to insert mvrs data into the email notification content but it was not able to show anything, I attach the screenshot for your reference.

 

email notification Table

Requested Item (SC_re_item)

 

Email script

namePrintMRVSData

scripts:

"(function runMailScript(current, template, email, email_action, event) {
// Get the sys_id of the requested item
var ritmSysId = current.sys_id;

// Get the MRVS data (example: 'u_mrvs_variable_name')
var mrvsData = current.variables.u_vs_user_info_celonis; // Replace with your MRVS variable name

// Check if data exists
if (mrvsData && mrvsData.getRowCount() > 0) {
var tableHtml = '<table>';
tableHtml += '<tr><th>Column 1</th><th>Column 2</th></tr>'; // Replace with your column headers

for (var i = 0; i < mrvsData.getRowCount(); i++) {
var row = mrvsData.getRow(i);
tableHtml += '<tr>';
tableHtml += '<td>' + row.u_region + '</td>'; // Replace with your column values
tableHtml += '<td>' + row.u_region + '</td>';
tableHtml += '</tr>';
}
tableHtml += '</table>';

 

template.print(tableHtml);
} else {
template.print('No data found in Multi-row variable set.');
}
})(current, template, email, email_action, event);"

 

 

 

10 REPLIES 10

Dear Ankur,

Thank you for your patience of responding to me question and Im totaly lost now I hope you can help me further.

1. the email notification I create is an approval email notification table (sysapproval_approver).

2. this is the mvrs variable name (u_vs_user_info_celonis).

3. inside this variable (u_vs_user_info_celonis) it contain the below variables.

  • u requested for celonis
  • u 422 username celonis
  • u email address celonis
  • u region celonis
  • u_country_celonis

All I need is to have an email script to get the information from mvrs variables (u_vs_user_info_celonis) which contain the above 5 variables.

 

Thank You.

 

Regards,

TMKam