- 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:10 AM
Hi,
you need to do string manipulation and then retrieve the data
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2020 08:22 AM
Ankur,
Thank you for your response, do you have an example? I have a few different fields that I need to populate with this method, hence a good starting point would be an example.
Many thanks
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2020 08:26 AM
Hi,
I assume you are using inbound email flow in flow designer
refer below links for help
Flow Designer - pull text from email body and act upon value
Has anyone managed to get Inbound Email Flow Designer working?
Also flow designer inbound email flow doesn't have that much capability as compared to inbound email action. So I would suggest if the flow approach doesn't work then please use inbound email action.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2020 08:33 AM
Ankur,
We extensively use flow designer for many solutions, so won't be switching to email inbound actions. I have some scripts that do funky stuff already with regards to subject lines, however in this case I want to scrape the body.
The flow designer has everything we need to pull this information in and with the (fx) coding will be fine, just having trouble finding the correct code to scrape the description.
I hope that helps to explain
Thanks
Steve