- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2023 05:49 AM - edited 11-07-2023 06:51 AM
I need to look for an inbound email but I want to extract a contract number from it - Here is the example - I want the short description to be CW2230211 PLUS the Subject Line of the incoming email. I tried doing
var stringFromBody = email.body.cw;
current.short_description = stringFromBody + ", " + email.subject;
Any ideas on how I can achieve to pull that contract number out of there and have it be first plus whatever the subject line is? The above gives me 'Undefined'
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2023 08:15 AM
Hi @Wendy Peterson ,
you can extract first line as below
var contract =email.body.the_following_contract_workspace_requires_review; //this would give the entire firs line
contract = contract.split("MSA_"); //split to get contract number
var cw =contract(1) //this would give only contract number
current.short_description = cw+" "+email.subject; //append contract number with short description
Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2023 08:15 AM
Hi @Wendy Peterson ,
you can extract first line as below
var contract =email.body.the_following_contract_workspace_requires_review; //this would give the entire firs line
contract = contract.split("MSA_"); //split to get contract number
var cw =contract(1) //this would give only contract number
current.short_description = cw+" "+email.subject; //append contract number with short description
Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025