body is empty in email notification.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2022 09:54 PM
Hi Team,
I am trying to trigger a notification email body is set as empty.
Below is my email script.
var record = new GlideRecord('sc_req_item');
record.get('76af537a87850110e93363150cbb353d'); //replace with your RITM sys_id
var vars = record.variables.getElements(true);
for (var i=0;i<vars.length;i++) {
var now_V = vars[i];
if (now_V.isMultiRow()) {
var rows = now_V.getRows();
for (var j=0; j<now_V.getRowCount(); j++) {
var row = rows[j];
var cells = row.getCells();
for (var k=0; k<cells.length; k++) {
var cell = cells[k];
if(cell.getCellDisplayValue() != ""){
gs.info(cell.getLabel() + ":" + cell.getCellDisplayValue());
}
}
}
}
else
{
var question = vars[i].getQuestion();
if(question.getDisplayValue() != ""){
gs.info(question.getLabel() + ":" + question.getDisplayValue());
}
}
}
In the background script it's working but getting blank body

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2022 09:58 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2022 10:19 PM
this script prints variables of the RITM , in the background script i tested it is working but when i mentioned this email script in my notification i am getting blank body

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2022 10:25 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2022 10:26 PM
Hi,
I think you have not printed anything that you want to appear in the mail template.
Whatever you want to be printed in the mail template, you should enclose that within the template.print() function.
Ex: Iam printing the start date and end date of a change
template.print("<br/>Planned Start Date: " + start_date + " <br/>Planned End Date: " + end_date);
Hope this helps:)
Please mark correct/helpful if it has answered your query.