email script

Jayaprakash P
Tera Contributor

Hi Guys,

 

I have created a mail notification and added email script to include a DL in the CC.

But when the email is triggered, the CC is not in the recipient's list.

 

 

 

below is the code i used in email script.

 

(function runMailScript(current, template, email, email_action, event) {

          // Add your code here
          var ccd= 'GSS_XXX@yy.com';
          email.addAddress('cc',ccd,'GSS_XXX@yy.com');

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

Paul Curwen
Giga Sage

Your Type parameter looks wrong. The Type parameter can either cc or bcc. Try:

 

 

          var ccd= 'GSS_XXX@yy.com';
          email.addAddress('cc', 'gss_xxx@yy.com');

 

 

***If Correct/Helpful please take time mark as Correct/Helpful. It is much appreciated.***

Regards

Paul

Hi Paul, thanks for the response,

But i didn't use bcc. I stored mail id in ccd variable and use the variable in the addAddress function.

          var ccd= 'GSS_XXX@yy.com';
          email.addAddress('cc',ccd,'GSS_XXX@yy.com');

1__AnithaHV
Kilo Sage

@Jayaprakash P 

Please use the below script and try.

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {
var ccd= 'GSS_XXX@yy.com';
  email.addAddress("cc", ccd, please specify the name of the user email);
   	})(current, template, email, email_action, event);

yad_achyut
Giga Guru

Hello @Jayaprakash P :
Give a try to the below given script :

 

var ccd = 'GSS_XXX@yy.com';

email.addAddress("cc", ccd ,'name');

 



Also check whether you have called the email script in the body of the notification or not ? and have a look on the recipient(To)value as it should not be blank while triggering the notification.