We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

How to change the header in notification

Asha Pathak
Tera Contributor

I have requirement where we need to change header in notification , How can I achieve it? Please help!

 

 

1 ACCEPTED SOLUTION

Not applicable

Hi @Asha Pathak ,

If your instance is set up to use your organization's own mail server or a hosted service such as Office 365, it's recommended to set up a rule (using whatever mail server software/service you're using) to add the custom header. If that's not possible, or if you're using the ServiceNow mail infrastructure (the default option) you can use a Business Rule to insert the custom header (tested working on Madrid):

Create a Business Rule:

  • Name: "Add Custom Email Headers" (can be whatever you like)
  • When to run: before
    • Insert ticked
    • Update ticked
  • Order: 100
  • Advanced
    • Use the following script as an example (replace "X-MyCustomHeader" with the name of the header and current.instance with the variable or literal value that you want in the header:
      (function executeRule(current, previous /*null when async*/) {

         if(current.headers.indexOf("X-MyCustomHeader") < 0){
         current.headers = "X-MyCustomHeader:" + current.instance + "\n" + current.headers;
      }

      })(current, previous);

      Also, refer to this solution :https://www.servicenow.com/community/developer-forum/adding-extra-configuration-to-email-notificatio...

 

View solution in original post

5 REPLIES 5

Not applicable

Hi @Asha Pathak ,

That's not the correct approach at all. You should never touch the PROD.

The only option you have is to Clone Prod to Dev and Test.