Catalog variables can be placed in an email notification by scripting. This is easy.
Placing the variables in a nice table is more difficult, a little html knowledge is required.

Building the html code has to be done by using the template.print(”); functionality.

Normally you would build a table like this:

<mail_script>

template.print(‘ <table border = “1”>’);

template.print(‘<tr><td>Field</td> <td>Value</td></tr>’);

template.print(‘<tr><td> UserName</td><td>stefan</td>’);

template.print(‘<tr><td> Phone</td><td>0612345678</td></tr>’);

template.print(‘</table>’);

</mail_script>

However, Service-now wants to end the table as fast as possible and finds an end of a row (</tr>) often a good place to end the table.
Also Service-now can find the end of a table cell </td> a possibility to end the table.
A simple script like this will probably go alright, but when there is other code between the ‘template.
Print’ actions, the system adds code automatically, this will change the script with errors as a result.
Continue reading…»