Summary
In some cases there maybe a need to add a custom header to emails generated from ServiceNow platform. This can be achieved via business rules.
Instructions
To add custom header, do the following:
- Create a business rule on the sys_email table ("on before", "insert/update")
- The script is below. It is important to put your headers BEFORE ServiceNow headers.
If you simply append your headers, they will be cut off.
/* add headers */
if(current.headers.indexOf("X-My-Header-Here") < 0){
current.headers = "X-My-Header-Here: " + headerValue + "\n" + current.headers;
}