- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2024 05:37 AM
Good Morning,
Can anyone help or point me to a tool OOTB that i can use to separate this subject line into multiple variables on a catalog item?
Subject Line = Termination for John Smith, 603677 (2025-01-10)
Trying to separate the name into one variable the number into another along with the date into a third. the body of the email is useless to use as everything is in the subject.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2024 06:10 AM
I'm guessing you are using an inbound action for this? You will have to script it. If it's always in this format, you can do something like this:
var subject = email.subject;
var arr = [];
subject = subject.substring(16); //Removes the "Termination for " beginning string
var commalocation = subject.indexOf(',');
var name = subject.substring(0, commalocation); //The name is the resulting string up to the comma
subject = subject.substring(commalocation + 1).trim();
arr = subject.split(' ');
var id = arr[0]; //The first part of the resulting string is the ID
var date = arr[1].substring(1, arr[1].length - 1); //The second part of the resulting string is the date in parentheses
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2024 06:41 AM
Thank you for marking my response as helpful.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2024 10:28 PM
As per new community feature you can mark multiple response as correct
If my response helped please mark it correct as well so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader