- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
I've been doing some digging and trying to find an answer to this - I've found various different questions/articles that are marked as correct and working. However, they do not work for me as I get an error when trying to create the record stating 'Error: "email" is not defind.,Detail: "email" is not defined.
Here are the two methods I've found that are 'correct' but fail -:
var splitext=email.body_text;
var splittoget=splitext.split('My_Department_Number:')[1];
var splittogetfinal=splittoget.split(' ')[0]; //This will give final result
var bodyis=email.body_text; //gives you complete body of email var alerttext=bodyis.split('Alert Level:')[1]; //This gives you text after Alert Level var gettext=alerttext.split('HostName:')[0];//this gives the text before HostName
Neither work and throw the same error. Is something else required before this script to define email?
For reference, this is intended to be an Inbound Email trigger on a flow, which creates a record and will populate various fields based on what is put on the email. There will be multiple fields to populate, and we want to split each field out from the email, which I assume using the above options for script would work.
Obviously, I'm changing the details in the above to be the field on the email in question, before anybody asks if I changed them 😄
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
Follow below article and video
https://www.youtube.com/watch?v=wYnwEfcUNnU
If this helped to answer your query, please mark it helpful & accept the solution.
Thanks,
Bhuvan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
Follow below article and video
https://www.youtube.com/watch?v=wYnwEfcUNnU
If this helped to answer your query, please mark it helpful & accept the solution.
Thanks,
Bhuvan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
This shouldn't be required to get this to work surely.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
@Bhuvan tried it anyway, made no difference.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
hi if you have to access the unbound email body values
Synatax:
var short_desc=fd_data.trigger.inbound_email.body_text;
//gs.info("test55 my email body text +"+short_desc);
return short_desc;
steps:
1) i have created flow .trigger inbound email
(and create the incident with email body);
2)its working .Please find screenshot
after tessting
Created incident
Actual email
If my response/article helped you, please mark it as the correct answer and close the thread — this helps other readers in the community.
Regards,
Tejas
🚀 ServiceNow Developer | 🏆 HackaNow Finalist | 💡 Community Contributor
📧 Email: tejas.adhalrao11@gmail.com
🔗 LinkedIn: linkedin.com/in/tejas1018
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Doesnt' work as needed as it pulls the whole body of the email. I've figured it out now anyway.