system notification

ahmed-24
Tera Contributor

I want the additional comment to be sent out and close notes. If the problem is resolved with close code "Workaround" then I also want the Incident Workaround to sent out. 

I need to use mail script to check whether the field u_workaround contains a value or not.

Canone has answer for that please?

2 REPLIES 2

SAI VENKATESH
Tera Sage
Tera Sage

Hi @ahmed-24 

You can try to adjust to adjust your script from the below script:

 

var emailBody = "";
emailBody += "Additional Comments: " + current.comments.getJournalEntry(1) + "\n";
emailBody += "Close Notes: " + current.close_notes + "\n";
if (current.close_code == "Workaround" && current.u_workaround) {
    emailBody += "Incident Workaround: " + current.u_workaround + "\n";
}

// Send email
gs.eventQueue('email.send', current, emailBody, "Incident Resolution Notification");

 

Thanks and Regards

Sai Venkatesh

What do you think about this one : 

// Get the record being used in the email notification context
var record = current;

// Initialize the email body variable
var emailBody = "";

// Check if the u_workaround field is empty
if (gs.nil(record.u_workaround)) {
    emailBody += "The Workaround field is empty.\n";
} else {
    emailBody += "Workaround: " + record.u_workaround + "\n";
}

// add more information about the record
emailBody += "Record Number: " + record.number + "\n";
emailBody += "Short Description: " + record.short_description + "\n";

// Set the email body
email.setBody(emailBody);