- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 02:02 AM - edited 04-17-2024 07:36 AM
I have requirement where we need to change header in notification , How can I achieve it? Please help!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 03:02 AM
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...
- 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:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 03:02 AM
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...
- 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:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 03:06 AM
@Community Alums I have tried this , but on prod there was already set the header and no any business rule for it
How to set it by another way
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 03:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-17-2024 03:12 AM
@Community Alums Yes we have to set it to directly prod, and the configuration is not on dev and test instance