Inbound email Action Requested Item Replies creating multiple tickets and not comments

mattmm
Kilo Sage

I have an Inbound email action I’ve created to create Requested items when an email is sent to a particular mailbox  e.g abc123@cba321.com

Target table: sc_req_item

Action Type: Record Action

Active: yes

Stop processing: yes

When to Run

Type: New

Conditions > Recipients contains abc123@cba321.com

Actions

createRequest();
function createRequest() {
   var cart = new Cart();   //calling the cart API
   var item = cart.addItem('<SYSIDOFCATITEM>');   //sys_id of the catalog item I want to fire
   cart.setVariable(item, 'ps_desc', email.body_text);   //sets catalog variable to email's body
     var rc = cart.placeOrder();   //this launches the catalog item, and creates a request object.   rc = the request object
	 updateRITM(rc.sys_id);   //call a function immediately to update the ritm.   This must be a nested function, otherwise inbound actions get weird.
           //also, we're passing the sys_id of the request so we know what RITM to grab.
}
function updateRITM(req){
   var ritm = new GlideRecord('sc_req_item');
   ritm.addQuery('request', req);   //req is what we passed from the previous function. the sys_id of the request.
   ritm.query();
   while (ritm.next()){
       ritm.opened_by = gs.getUserID();          
       ritm.description = "received from: " + email.origemail + "\n\n" + email.body_text;   
	   ritm.short_description = email.subject;
	   ritm.requested_for = ritm.opened_by;
	   ritm.assignment_group = '<SYSIDOFASSIGNMENTGROUP>';
       ritm.update();
   }
}
function copyAttachments(cartItemID, rc) {
	GlideSysAttachment.copy('sys_email', rc, 'sc_cart_item', cartItemID);
}
current.setAbortAction(true);
event.state="stop_processing";

My issue is that A user emails abc123@cba321.com which correctly creates an RITM000111 with the desired info in Short description and Description.

The abc123 team then reply to that user via email, and the user in turn replies back, but the issue is now it creates another RITM000112.

With each subsequent reply to abc123@cba321.com a new ticket is created. I want it to add the new reply as comments to the original RITM not create a new one. How do I achieve this?

I updated the Update Requested Item inbound action with the condition > recipients is abc123@cba321.com and action below, but no luck.

gs.include('validators');

if (current.getTableName() == "sc_req_item") {
	current.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
	
	if (gs.hasRole("itil")) {
		if (email.body.assign != undefined)
			current.assigned_to = email.body.assign;
		
		if (email.body.priority != undefined && isNumeric(email.body.priority))
			current.priority = email.body.priority;
	}
		current.update();
}
1 ACCEPTED SOLUTION

Hi Matt,

Why don't you just redirect the PeopleServices@company.com address straight to ServiceNow and then manage the responses from there? That way all information would be captured in ServiceNow and the notifications managed by ServiceNow (these would contain the watermark).

If the fulfiller team is managing their work, and responding to customers directly through the exchange group email then their responses will never be captured by ServiceNow. ServiceNow will also have no way to correlate the customer replies to the original ticket and will therefore see it as a "New" email and create a duplicate ticket. 

Brent

P.S. If my suggestion helped then please mark as helpful and/or correct so other community members can benefit from this information.

View solution in original post

12 REPLIES 12

There are no stupid questions Brent! But I've used that preface before answering with a stupid question! How do I check for a watermark, is this an Exchange thing or does ServiceNow add it in my original inbound action?

 

Hi Matt,

The watermark will be at the bottom left of your email notification. It is used to match up the response to an email with the source record and should be added automatically to your email notification (see screenshot below):

find_real_file.png

Brent

P.S. If my suggestion helped then please mark as helpful and/or correct so other community members can benefit from this information.

Thanks Brent!

Just had a read up and I see what you mean, and I think this highlights my issue and I wonder whether what I want to achieve is possible.....

So looks like ServiceNOw adds a REF watermark to notifications so if a user is replying to a ServiceNow generated Watermark it can reference this.

My issue is a little different. I have our exchange server forwarding internal  emails to our Servicenow instance and people are replying to each other on this internal email.

For Example:

Our internal Email address is PeopleServices@company.com 

  1. Joe.blogss@company.com sends an email to the above asking for help with his payslip.
  2. This arrives in the PeopleServices@company.com but exchange also forwards this to ServiceNOw and a ticket is generated.
  3. However, in the meantime PeopleServices@company.com have replied to Joe asking for clarification
  4. Joe then replies to PeopleServices@company.com again with his answer and therefore another forward is done to ServiceNow where another ticket is generated.

Is it even possible for ServiceNow to recognise how these messages relate if they are separate forwards (albeit of the same email reply trail) to ServiceNOw?

Hi Matt,

Why don't you just redirect the PeopleServices@company.com address straight to ServiceNow and then manage the responses from there? That way all information would be captured in ServiceNow and the notifications managed by ServiceNow (these would contain the watermark).

If the fulfiller team is managing their work, and responding to customers directly through the exchange group email then their responses will never be captured by ServiceNow. ServiceNow will also have no way to correlate the customer replies to the original ticket and will therefore see it as a "New" email and create a duplicate ticket. 

Brent

P.S. If my suggestion helped then please mark as helpful and/or correct so other community members can benefit from this information.

I'm with you Brent. Yes, my issue is more of a training issue with the HR staff. They should be working out of ServiceNOw off the original ticket and not trying to work off the email. My plan is to discuss this with them and then lock down the ability to reply to emails going to that mailbox.