replying-all to inbound email

patricktivnan
Kilo Contributor

HI,

So we have customers that email different support distros for various issues. Our service-now email as well as other admins emails are apart of these distros. I created an inbound action to create incident tickets based off what distros are being mailed. This part is working fine. See my condition and code below..

Condition:

email.to.toLowerCase().indexOf("email1@test.com") >= 0 || email.to.toLowerCase().indexOf("email2@test.com") >= 0 || email.to.toLowerCase().indexOf("email3@test.com") >= 0 || email.to.toLowerCase().indexOf("email4@test.com") >= 0

current.caller_id = gs.getUserID();

current.short_description = email.subject;

current.description = "Received from: " + email.origemail + " From: " + email.from + "\n\n" + email.body_text;

current.assignment_group.setDisplayValue("NOC/Ad Services");

current.incident_state = 1;

current.insert();

Workflow is like this:

User -> Email1@test.com --> triggered inbound email --> ticket created.

Now, my dilemma is that when someone from Email1@test.com distro decides to reply all, the inbound action script triggers again. Reason is SN thinks that its a New Email being processed because there is no present watermark in this email thread.

So is there a way that SN can reply-all to the email thread when my inbound action is triggered? This way the watermark is entered into this thread, and any replies will be known as a 'reply' by the SN system. Keep in mind the original customer may add other users that is why I want to reply-all to the original email that was sent. I am not sure how to work this with an event/email notification system that SN has.

Thanks!

6 REPLIES 6

Right, but so there is no way for me to Reply All with an email notification to email.to ?


Yep.   You can queue up an event in your inbound action:



gs.eventQueue('event.name', context, email.to, null);



Set your email notification to trigger on 'event.name'.   In the email body of the notification use a mail_script that parses email.to and add it to the Cc: field of the notification.   I haven't tested it but I imagine it would look something like this:



<mail_script>


var email_addresses_arr = event.parm1.split(",");


var len = email_addresses_arr.length, i = 0;


for( i; i != len; i += 1) {


email.addAddress("cc", email_addresses_arr[i], "");


}


</mail_script>