How to call email script into email layout

avinashdubey103
Tera Guru

Hi I have created a email layout and one email script .

I want to call the email script on the email layout image 

Email layout code :
<p></p>
<p></p>
<table class="center" border="0" style="border: none; width: 73.5843%; height: 30%;">
<tbody>
<tr style="height: 205.039px;">
<td style="width: 24.7355%; border-top: none; border-right: none; border-left: none; border-image: initial; border-bottom: 4.5pt solid white; background: white; padding: 0in; height: 205.039px;">&nbsp;&nbsp;</td>
<td style="width: 75.2337%; height: 205.039px; text-align: center;"><img title="AmdocsHeader.jpg" src="AmdocsHeader.jpg" alt="" width="100%" height="100%" data-library="false" /></td>
</tr>
<tr style="height: 31.4062px;">
<td style="width: 24.7355%; border-top: none; border-right: none; border-left: none; border-image: initial; border-bottom: 4.5pt solid white; background: white; padding: 0in; height: 31.4062px;"></td>
<td style="width: 75.2337%; height: 31.4062px;"><span style="font-size: 12pt;">${notification:body}</span></td>
</tr>
<tr style="height: 89.1797px;">
<td style="width: 24.7355%; border-top: none; border-right: none; border-left: none; border-image: initial; border-bottom: 4.5pt solid white; background: white; padding: 0in; height: 89.1797px;"></td>
<td style="width: 75.2337%; height: 89.1797px; text-align: center;"><a href="${mail_script:surveycreated}"><img title="AmdocsFooter.jpg" src="AmdocsFooter.jpg" alt="" width="100%" height="100%" data-library="false" /></a></td>
</tr>
</tbody>
</table>

 

 

email script :


 

(function runMailScript(current, template, email, email_action, event) {
      var imageUrl = "https://" + url + ".service-now.com/AmdocsFooter.jpg";
      var surveyUrl = '';

        surveyUrl = gs.getProperty('glide.servlet.uri') + 'home/feedback_survey.do?sysparm_feedback=' + current.u_assessment_instance.sys_id;
        gs.log("Survey URLAvinash"+surveyUrl);
       


       template.print("<html><body><a href='" + surveyUrl + "'>  <img src='" +imageUrl  + "'> </img>  </a></body></html>");


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


it is not adding the  sruvery in the image 
3 REPLIES 3

Sandeep Rajput
Tera Patron
Tera Patron

@avinashdubey103 I recommend you to put the entire HTML inside your email script and use template.print to print the HTML. 

it was implemented this way only but now the requirement has come to print it from layout 

SatheeshKumar
Kilo Sage

Hi @avinashdubey103 

You can call it int he below format in the layout section of email template

${mail_script:company_email_header}