- 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
4 hours ago
Hi @StewartFletcher ,
Why you see the error
In Business Rules or Script Actions for inbound email, you can access the email object via email or email.body_text.
In Flow Designer Inbound Email triggers, there is no email object — instead, Flow Designer passes email content through Data Pills (like Body Text, Subject, From, etc.).
What you should do
Don’t use email.body_text in Flow Designer.
Use the Data Pill → Email → Body Text directly.
If you want to split text, use a Script Step in the flow.
// input: bodyText = trigger.current.body_text (map the data pill here)
var result = {};
var splitext = bodyText.split('My_Department_Number:')[1];
if (splitext) {
result.departmentNumber = splitext.split(' ')[0];
}
var alertText = bodyText.split('Alert Level:')[1];
if (alertText) {
result.alertLevel = alertText.split('HostName:')[0];
}
return result;
Then map result.departmentNumber and result.alertLevel to the fields you want on your record.