Comments on: Manipulating Outbound Email in the ‘sys_email’ Table https://servicenowguru.com/email-notifications-system-definition/manipulating-outbound-email-sysemail-table/ ServiceNow Consulting Scripting Administration Development Tue, 28 May 2024 21:12:00 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Philippe SIEK https://servicenowguru.com/email-notifications-system-definition/manipulating-outbound-email-sysemail-table/#comment-7373 Tue, 12 Jul 2011 11:59:41 +0000 https://servicenowguru.wpengine.com/?p=1892#comment-7373 Hi,

Thanks for your reply.
Yes, I’ve seen this post while I was looking for a solution.
My problem is that notifications from workflows do not handle accentuated caracters correctly, they are replaced by “?” in the email body.
It seems that the encoding / content type is different between email from standard notifications and workflow (“content-type” = “text/html” for workflow and “mixed/mutliparts” for standards ones).

Once again thanks for you reply (and for this blog also)

Regards,

Philippe

]]>
By: Mark Stanger https://servicenowguru.com/email-notifications-system-definition/manipulating-outbound-email-sysemail-table/#comment-7372 Tue, 12 Jul 2011 11:49:40 +0000 https://servicenowguru.wpengine.com/?p=1892#comment-7372 In reply to Philippe SIEK.

I’ve never had success setting headers in email notifications…even with a business rule as described here. The most common use for manipulating headers (setting the importance flag) has been addressed though. See this forum post for more details.
http://community.service-now.com/node/1000684

]]>
By: Philippe SIEK https://servicenowguru.com/email-notifications-system-definition/manipulating-outbound-email-sysemail-table/#comment-7371 Tue, 12 Jul 2011 11:42:40 +0000 https://servicenowguru.wpengine.com/?p=1892#comment-7371 Hi,

I would like to know if it’s possible to modify email’s header in .
I’ve tryed email.setHeader(“header name”, “value”), but without success.
Any ideas ?

Regards,

]]>
By: Mark Stanger https://servicenowguru.com/email-notifications-system-definition/manipulating-outbound-email-sysemail-table/#comment-7370 Wed, 13 Apr 2011 15:53:36 +0000 https://servicenowguru.wpengine.com/?p=1892#comment-7370 In reply to Wesley Van Sickle.

I’m not referring to any specific notification…you’ll have to determine what notification is being used in your environment and modify it accordingly. I’m not sure what that would be in your environment.

]]>
By: Wesley Van Sickle https://servicenowguru.com/email-notifications-system-definition/manipulating-outbound-email-sysemail-table/#comment-7369 Wed, 13 Apr 2011 15:32:10 +0000 https://servicenowguru.wpengine.com/?p=1892#comment-7369 Mark, what email notification are you referring to? In our initial Incident Assigned to Me notification this is the subject “${number} assigned to you (${assigned_to}): ${short_description}”

]]>
By: Mark Stanger https://servicenowguru.com/email-notifications-system-definition/manipulating-outbound-email-sysemail-table/#comment-7368 Mon, 11 Apr 2011 13:32:06 +0000 https://servicenowguru.wpengine.com/?p=1892#comment-7368 In reply to Wesley Van Sickle.

This is possible. The easiest way is just to change the subject in the email notification. If, for some reason, you need to send the email with the contact information (as shown in your first example) but then take the information out so that it isn’t in the activity log, you could use a business rule as explained here to parse the information from the subject line when the email log entry changes to a sent state. I don’t have a pre-built script for that, but it should be very simple to figure out.

]]>
By: Wesley Van Sickle https://servicenowguru.com/email-notifications-system-definition/manipulating-outbound-email-sysemail-table/#comment-7367 Fri, 08 Apr 2011 22:15:08 +0000 https://servicenowguru.wpengine.com/?p=1892#comment-7367 We currently right our analyst cell number to the activity log. We would like that to be be hidden/masked from end users/analysts. We are concerned that folks will call these numbers outside of ticket escalation

We would like to determine if replacing current message in activity log with informative text instead would be feasible request.

Today the Activity Log message reads:

Sent: xxxxxxxxxx@vtext.com

From:Service Desk Sent: 2011-04-08 08:50:31

To: xxxxxxxxxx@vtext.com

Subject:

Body:

Incident INC459498 assigned to you. Contact: Caller at xxxxxxxxxx.

Suggest changing header message to read: On call has been paged for immediate assistance.

We would like it to read –

Sent: On call has been paged for immediate assistance.

From:Service Desk Sent: 2011-04-08 08:50:31

To: xxxxxxxxxx@vtext.com

Subject:

Body:

Incident INC459498 assigned to you. Contact: Caller at xxxxxxxxxx.

]]>
By: valor https://servicenowguru.com/email-notifications-system-definition/manipulating-outbound-email-sysemail-table/#comment-7366 Mon, 15 Nov 2010 14:26:45 +0000 https://servicenowguru.wpengine.com/?p=1892#comment-7366 I’ve used this technique for 2 reasons:

1. prevent duplicate emails from going out to users (when you otherwise can’t figure out why)

2. to attach a file to an outgoing message.

Here’s the code I used for #1:

Name: Prevent duplicate emails

When: before / insert

Condition: current.mailbox == ‘outbox’

Script:

 
// match Subject AND body?
 
var bodyCheck = false;
 
 
 
if (getSimilar(bodyCheck)){
 
   current.mailbox = "ignored";
 
   current.type = "send-ignored";
 
}
 
 
 
 
 
function getSimilar(body){
 
   var bodyText = current.body_text.toString();
 
   var ref = bodyText.toLowerCase().indexOf('ref:msg');
 
 
 
   var eml = new GlideRecord('sys_email');
 
   eml.addQuery('sys_id', '!=', current.sys_id);
 
   eml.addQuery('target_table', current.target_table);
 
   eml.addQuery('instance', current.instance);
 
   eml.addQuery('subject', current.subject);
 
   eml.addQuery('recipients', current.recipients);
 
   eml.addEncodedQuery('sys_created_onRELATIVEGT@minute@ago@1');
 
   if (body && body === true && ref > 0){
 
      bodyText = bodyText.substring(0, ref);
 
      eml.addQuery('body_text', 'STARTSWITH', bodyText);
 
   }
 
   eml.query();
 
   return eml.hasNext();
 
}
 
]]>