Inbound email action to look for Error status records and map it to Description field

Shaji T M
Tera Contributor

Hi Team,

I'm in the process of setting up an inbound action to create an incident ticket for a specific back up error email.

I'm getting an email with the below contents.

ShajiTM_0-1700678194838.png

I have to look only for error records from the above table and get the corresponding Name and Status values and map it to Description field.

OHGL1 Error
MOB1 Error
MOS01 Error 

The error records count may change. 

Any help on this will be highly appreciated.

Thanks 

 

3 REPLIES 3

Teo Gamarra
Tera Expert

Try to set up an inbound action script that parses the email for error records, extracts the 'Name' and 'Status' for each error, and maps this data to the description field of a new incident ticket, and extract the necessary information.

Teo Gamarra
Tera Expert

Try to set up an inbound action script that parses the email for error records, extracts the 'Name' and 'Status' for each error, and maps this data to the description field of a new incident ticket, within the script extract the necessary information.

Tony Chatfield1
Kilo Patron

Hi, any solution will depend on the format of your data. I think I would try to use string split() to separating the rows out from the body_text into individual array elements, and then loop through the row elements separating the individual row 'entries' with split(). You can then loop through each row element checking for your error.

Pseudo code as is dependent on your actual data,

but something like this.

var myDescription = '';

//Split the table based on the character that terminates the rows.
var myRows = email.body_text.split('\n');

//Parse the results
for(rec in myRows) {

//Split each row based on character that seperates the row entries.
var myRecord = myRows[rec].split('\t');

//check if the row is an error.
if(myRecord[1].indexOf('Error' != -1) ) {
//Append required details from the row to your description variable
myDescription = myDescription + myRecord[0] + ' ' +  myRecord[8] + '\n';
}

//Map your description data to the target record.
current.description = myDescription;