- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2020 08:04 AM
Hi Community,
Hope you are all keeping well. I have a particular use case for scripting in flow designer whereby I want to scrape the body of an email and search for the text that contains the Ticket Description: [Ticket: Description] in the body as below and then returns the text after the Ticket Description within the same line.
The above will be used in my flow to map (fx) to the description within the ticket flow,
Can someone please provide guidance on the search string which should be used to identify the ticket Description text and the return the string after.
Many thanks
Steve
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2020 08:34 AM
Hi,
Here is how you can do a check
//str should be your email body.
var str = fd_data.trigger.current.body_text.toString();
if (str.indexOf("Ticket Description:") > -1) {
var body = str.split("Ticket Description:");
body = body[1].toString();
body = body.split("\r\n");
var ticket_desc = body[0].toString(); // This will store your ticket description
}
Mark the comment as a correct answer and also helpful if this solves the problem.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2020 08:34 AM
Hi,
Here is how you can do a check
//str should be your email body.
var str = fd_data.trigger.current.body_text.toString();
if (str.indexOf("Ticket Description:") > -1) {
var body = str.split("Ticket Description:");
body = body[1].toString();
body = body.split("\r\n");
var ticket_desc = body[0].toString(); // This will store your ticket description
}
Mark the comment as a correct answer and also helpful if this solves the problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2020 08:54 AM
Asifnoor,
Thank you for the guidance, much appreciated.
Many thanks
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2020 05:53 AM
Asifnoor,
I just tested out the solution, which unfortunately didn't work, so I tested out this script which copies the body of the email into the description field, however now I need to just copy the information that will exist on one line after the Ticket Description:
This is what I used which did copy the body to the description field:
var shortDesc1 = '';
var shortDesc2 = '';
shortDesc1 = fd_data.trigger.inbound_email.body_text
shortDesc2 = shortDesc1.replace('Ticket Description', '');
return shortDesc2;
Are you able to advise the correct code to copy the line of text after the Ticket Description, but not anything below it and return the output to the description field, which works as above?
Many thanks
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2020 12:44 AM
Asifnoor,
Ignore that last message, needed to make some changes to the script and managed to get this working like you mentioned,
Thanks again
Steve

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2020 12:56 AM
Okay, cool.