Parsing the Content of Email, Auto-setting Based on It

Parsing the Content of Email, Auto-setting Based on It
Introducing how to automatically Start a Process by receiving an email, and to input the data into Data Items by parsing the contents of the email automatically.

Hi, there.
I will talk about the implementation of simple JavaScript this time.

We often receive the following sort of requests:
“I would like to start work based on the contents of an email after receiving it!”

[Message Start Event (Email)] enables to achieve the request!

Process diagram using [Message Start Event (Email)] (Credit confirmation application)
*Normally, Script Task cannot be placed before the first task. However, it COULD be placed if the start event is an automatic start type event. (Convenient!)

Among Questetra BPM Suite Users, this function has been relatively known.
By retrieving Email from systems other than Questetra BPM Suite, system coordination can be implemented easily.

You will be free from boring tasks such as
Receiving prosaic emails, copying and pasting it into another system.

However, we also hear requests from some Questetra BPM Suite Users like

“We automatically import order notification emails from mission-critical systems into Questetra BPM Suite and process them. It’s handy, but very troublesome to copy and paste customer names, order amounts etc. Into the input form from the body of the email! Couldn’t you find some way?”

We can do something about it!
In the case of a standard format, we can deal with it by using a “Script Task”

Email Body Example

Customer Name: AAA Corporation

Since the refurbishment will be completed on May 4, 2019, please make drawings according to the specifications.
Delivery time is until December 20, 2018.
Questetra, Inc.
Jack Brown <>
Branch Name: East branch Group Name: Construction group

If the email body consists of the following standard format:

  • Customer name is set following to the title character string “Customer name :”
  • Branch name is set following to the title character string “Branch name :”
  • Group name is set following to the title character string “Group name :”

, you just need to search the title string, get the string following it, and set it in the form of Process Data Item.

Script Task Implementation Example

var text = engine.findDataByNumber("15");
text = text.replace("\r\n", "\n");
var sep = ":";
var line = new Array();
line = new String(text).split("\n");
var customerName = "";
var branchName = "";
var groupName = "";
// Parse the "Request content" line by line and set them into Process Data Item
for(var i=0; i < line.length; i=i+1){
    var pos = line[i].indexOf(sep);
    var dat = line[i].slice(pos+sep.length);
    if (line[i].slice(0,pos)=="Customer Name"){
	customerName = dat;
    if (line[i].slice(0,pos)=="Branch Name"){
	branchName = dat;
    if (line[i].slice(0,pos)=="Group Name"){
	groupName = dat;

To deal with the data from Process Data Item as String type, we need to convert it into the string type object explicitly as shown in the fifth line. (NOTE!)

line = new String(text).split("\n");
Implementation Example (Task Processing Screen)


Don't you think it is also relatively easy to implement it with Script Task? Objects and Methods available for Script Task are listed in Manual (M230 AUTOMATED STEP Auto Executing Complicated Data Processing). Please refer to them and implement the Script.

I hope "Script Task" will help you extending the scope of use of Questetra BPM Suite more and more.

1 thought on “Parsing the Content of Email, Auto-setting Based on It”

  1. Pingback: RPA is Not the Only Automation! Various Examples of Automation by Cloud-based Workflow - Questetra

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: