- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2022 09:18 AM
I've never used the email.body.VARIABLE feature in Inbound Rules before.
The documentation from SNOW on this seems really straight forward.
I have a variable in the email called My_Department_Number:2069 on a single line.
I've tried using the suggest method for pulling the data out.
var myVari = "";
if (email.body.My_Department_Number!=undefined){
myVari=email.body.My_Department_Number.toString();
}
Nothing happens. I've tried even just using the var myVari = "" and myVari =... as two lines only.
This gives me a log entry that shows myVari is undefined.
If I hard code the ticket variable i'm attempting to populate, the inbound rules works fine.
What did i miss?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2022 11:38 AM
Try below
var splitext=email.body_text;
var splittoget=splitext.split('My_Department_Number:')[1];
var splittogetfinal=splittoget.split(' ')[0]; //This will give final result

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2022 09:51 AM
Can you directly try below instead of checking if
var myVari=email.body.My_Department_Number.toString();
If it still does not you can try something as below
var splitext=email.body_text;
var splittoget=splitext.split('My_Department_Number:')[1]; //this should give you the final value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2022 10:18 AM
OK, the second worked ok..
but the gs.log I have shows value I was wanting, however, it included everything after that number.
e.g. Thank You! Privacy Verbiage, etc....

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2022 11:38 AM
Try below
var splitext=email.body_text;
var splittoget=splitext.split('My_Department_Number:')[1];
var splittogetfinal=splittoget.split(' ')[0]; //This will give final result
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2022 11:14 AM
Thanks for the help.
Also found that the variable was set incorrectly.
It had a space between the name: value.
once it was set to name:value all went well.