Chaitanya ILCR
Giga Patron

Hi @Madhan007 ,

 

you script looks good it should work

cc and bcc will be populated in the copied and Blind Copied field of the email

ChaitanyaILCR_0-1751024894445.png

 

you can also use this script but your script should work fine

(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
    /* Optional EmailOutbound */
    email, /* Optional GlideRecord */ email_action,
    /* Optional GlideRecord */
    event) {

    var approvalgr = new GlideRecord('sysapproval_approver');

    approvalgr.addQuery('sysapproval', current.getValue('sysapproval'));
    approvalgr.query();
    while (approvalgr.next()) {

        if (approvalgr.approver && approvalgr.approver.email) {

            var emailString = approvalgr.approver.email.toString();
            var displayName = approvalgr.approver.name;
            email.addAddress("cc", emailString, displayName);

        }
    }


})(current, template, email, email_action, event);

in the background script context the email parameter is undefined so it will throw the error

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

View solution in original post