Inbound Email Actions - able to match an existing incident based on a ticket number from previous ticketing system being migrated over to SN?

bcronrath
Kilo Guru

We are migrating over to SN from a previous ticketing system.   Part of the migration will involve tickets that are already open in the old system, and clients will be expecting to still be able to reply to the old ticket subject lines for those tickets and get a response.   I can get emails to update existing incidents in our service now dev instance if I include the SN incident number format in the subject line, so moving forward it should be fine, however for those other tickets that we will be importing in that include the old format of ticket numbers (does not have "INC" in the ticket format) is there a way we can script our inbound email actions for incident updates to check on a different style of ticket number format?

Best regards,

Brian

1 ACCEPTED SOLUTION

Many organizations choose not to import ticket data from the old system, but obviously in some cases that may be required.   If you need to do this, you could create a custom field with the old ticket number, or even prefix the short description with it.   Then your inbound email script could do a query in whatever field you choose to match that ticket number.   First you could need to parse the email subject for the old ticket number, then use that in your query to find the existing incident created.   I hope this makes sense.


View solution in original post

35 REPLIES 35

Thank you Michael!



This is great!   Do I just create a new Inbound Email Action for this?



I'll let you know how are tests go.   If you're ever in Seattle I owe you a big stein of beer!


Best practice is to not edit the out of the box code.   So you should inactivate the existing "Create Incident" inbound email action and create a new one with the above code as it is using the out of the box code IF the old ticket number is not found in the email subject.



Please make sure you edit the "numberPattern" value to meet your numbering scheme.   Hopefully my comment makes sense to know what to change.   If not post here and I will try to help.   I will need some example ticket numbers to help.


I'm having trouble getting this to kick in.  



Here are some details (the bold one is your script with just field reference and pattern fixed):



Column control menuNameSortColumn control menuActiveSortColumn control menuEvent nameSortColumn control menuScriptSortColumn control menuTarget tableSortColumn control menuUpdatedSortColumn control menuOrderSort
Create Incidentfalseemail.read// Note: current.opened_by is already se...

Incident [incident]


2015-10-01 09:11:305
Update Incidentfalseemail.readgs.include('validators');


if (current...

Incident [incident]


2015-09-30 22:00:45


10
Create Incidenttrueemail.read// Note: current.opened_by is already...

Incident [incident]


2015-10-01 09:11:58


5

What difference does the order make on these?   Do I need to make any Reply or Forward references in "Email" to make this work?   Currently I have the new Create Incident Associated with "New" emails.



Thanks again for all your help!


For some reason the orders didn't come through above.   They are 5, 10, 5 respectively...But I don't think that matters as long as they are prior to other other actions...correct?


The "Reply/Forward" references shouldn't make a difference.   Just to make sure I took a random email in my inbox and clicked reply and then changed the To to my ServiceNow instance to see what would happen.   The Create Incident inbound email action processed it.



The order comes in where the inbound email actions are processed lowest to highest.   The following Wiki article explains how this works:


http://wiki.servicenow.com/index.php?title=Ordered_Email_Processing#gsc.tab=0