- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-17-2018 04:58 PM
Hi Everyone,
I am working on an inbound action and I can't seem to find out how to detect if the first line is blank in an email, with just a carriage return. I've tried finding \n \r and \n\n. indexOf() seems to return the first time they come up in a line that has text. I want to ensure that the text I'm parsing is on the first line of the email and then put the value after an @ symbol into the Affected User for a new Incident.
Any help would be appreciated. Here's what I'm using to get the character locations:
var body = email.body_text.toString();
var first_at_char = body.indexOf("@");
var first_new_line = body.indexOf("\n\n");
var first_less_than_char = body.indexOf("<");
The first_at_char is always returning 0, even if I put a bunch of carriage returns before it.
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2018 12:20 PM
Hi Viktor,
Thanks for taking the time to read this. How would splitting the string help me find out if there are carriage returns.
In the end, I just started parsing the email in the HTML format and that did the trick for me.
Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2018 12:04 AM
Hello
maybe this will help
var body = email.body_text.toString();
var first_line_of_body = body.split('\n')[0];
var first_at_char = body.first_line_of_body("@");
if first_at_char return 0, you can split a row by @
var text_before_at_char = first_line_of_body.split('@')[0];
var text_after_at_char = first_line_of_body.split('@')[1];
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-20-2018 12:20 PM
Hi Viktor,
Thanks for taking the time to read this. How would splitting the string help me find out if there are carriage returns.
In the end, I just started parsing the email in the HTML format and that did the trick for me.
Thanks!