how to fetch the case number in subject line of the inbound email

ShruthiMR
Tera Contributor

ServiceNow client leveraging the Case Management needs to automate Escalating Inbound email handling to ensure a case can be escalated just via replying to an email sent from the system to their inbox. For any inbound email coming with a specific subject line i.e., ‘Escalate Case for Caller <Case Number>’ should be escalated. Evaluate whether there is an active Case number in the system with that number, if so:

  1. Change the state of the case to ‘Awaiting Info’.
  2. Send an approval request to the Manager of the Assignment group.
  3. If rejected:
    1. mark the status of the case back to ‘Open’ and
    2. send an email to Consumer with Subject line: ‘Your request for escalation was rejected’.
  4. If the approval was approved:
    1. Add a comment in the work notes stating, ‘This case has been escalated as per request from caller with approval’.
    2. Create an Escalation (sn_customerservice_escalation) record within ServiceNow linking it with the original case.
    3. Update the comment from body of the email to this escalation case work notes.
    4. Send email to Consumer stating – ‘Your case has been escalated <Escalation Number>

 

4 REPLIES 4

Shree_G
Kilo Sage

Hello @ShruthiMR ,

 

Suppose the Escalation number is of 10 chars and the subject line is "Escalate Case for Caller ESC0000023", Then use below code to get the Escalation number :

var number = email.subject.substring(email.subject.indexOf('Caller')+7,37);

 


If this solution helped resolve your issue, please consider marking it as helpful or correct.
This will assist others in finding the solution faster and close the thread.

Ankur Bawiskar
Tera Patron
Tera Patron

@ShruthiMR 

Will this be a reply type email or new email?

If it's reply type your existing inbound action can be updated to handle this logic.

what did you start with and where are you stuck?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

existing inbound email action

 

@ShruthiMR 

if existing the what script did you update as per your requirement?

share that updated script.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader