How to add mail script to email template

steveturley1
Kilo Contributor

Hi.

I suspect this may be super simple.

I'd like to test the mail script '${mail_script:requested_items_summary_with_options}'

However, I'd like it to be part of or in addition to the email template 'request.itil.approve.role'

What would be the best way to do this?

Thanks!

 

 

 

1 ACCEPTED SOLUTION

Get your code in a fix script and debug there, it's much easier. If this question is answered please mark an answer correct to close it down

View solution in original post

7 REPLIES 7

Dubz
Mega Sage

Go to System Policy > Email > Templates

Open the template you want and call the mail script in the message body in the same way as you would a notification. ie: ${mail_script:requested_items_summary_with_options}

Thanks for the help. I've tried this and it causes the notification not to send. Any idea why?

A bug in your code can prevent the notification from sending. Try removing your code and just put the line:

template.print('this line');

And try sending the notification again, if it works you know it's not the way you're calling the mail script that's causing the issue. 

Feel free to post up your mail script code and/or the message body where you're calling it if you need any help with it.

Hi David

Thanks for the reply.

I removed the mail script and added the 'template.print('this line'); and it worked OK.

I reversed it and added the mail script back in and it failed to send.

I've added screenshots of the mail script, the email template and the conditions of the notification.