- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2022 11:36 PM
Hi,
Not so good with the scripting aspect and would appreciate if someone can help.
I have a requirement that needs to extract the Change or Incident number from email subject.
The email comes from same email address, but the subject line is different.
For example the Subject Line can be Unplanned Change : CHG123456789
Or Update: Unplanned Outage: INC123456789
How can we run the script that look at the subject and grabs the incident or change number?
Thanks in Advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2022 07:40 AM
Hi,
add similar regex for CHG also
var subject = email.subject.toString();
var regex = new SNC.Regex('/CHG\\d{9}/im');
var match = regex.match(subject);
gs.info(match);
If my response helped please mark it correct and close the thread so that it benefits future readers.
regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-31-2022 11:43 PM
Hi,
same thing for CHG
Your sample script will look like this when you use Inbound action
var subject = email.subject.toString();
var regex = new SNC.Regex('/INC\\d{9}/im');
var match = regex.match(subject);
gs.info(match);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader