Mail Script Parameters

Makosko
Tera Expert

Hello Gurus,

is there a way to pass an argument in to an email script when it is called from within an email template/notification ?

Including an email notification script as follows:

${mail_script:req_items}

Actual Script:

template.print("<p></p>Requested items:<br />");

var gr = new GlideRecord("sc_req_item");

gr.addQuery("request", current.sys_id);

gr.query();

while(gr.next()) {

  template.print(gr.number + ":   " + gr.cat_item.getDisplayValue() + ", Stage: " + gr.stage.getDisplayValue() + "<br />");

}

Cheers

6 REPLIES 6

Edwin,



thanks for posting your workaround. To be honest, I would be better off calling a script include as it would have access to the template variable anyway..



Basically what I was really after was an ability to call templates and populate them whenever needed. We have a notification, which has a lot of HTML code with inline CSS to create a body ( header with colors, centering it, width, padding etc.. ), to which I would like to push my own content. Essentially, the first template acts as a wrapper to ensure all emails look the same, have the same header, same colours, same width etc.. so when it comes to updating them all, I have only one place to go to...



I can post some examples + screenshots if you like ?



Cheers


Maros


Makosko The examples would be awesome.   I really like your approach and can pretty much envision it, but an example would be great to reinforce this.