reading email body from inbound email

Deepika54
Tera Contributor

hi experts,

 

An email will be coming to servicenow and inside that email's body , there will be data. i have to read that data and populate it inside a table in servicenow.Can anyone tell how to read the data from the emai's body.

7 REPLIES 7

SoniaShridhar13
Giga Guru

Hi! @Deepika54  

The easiest way to parse the data could be via the plain text version of the body IE email.body_text, using basic java-script string methods.

https://www.w3schools.com/js/js_string_methods.asp

Anubhav24
Mega Sage
Mega Sage

Hi Deepika,

You can use the "email" object to obtain data from inbound emails:

email.body_text: Contains the body of the email as a plain text string.
email.body_html: Contains the body of the email as an HTML string.

 

Also for other values you can refer below :

https://developer.servicenow.com/dev.do#!/learn/learning-plans/tokyo/new_to_servicenow/app_store_lea...

Sai Kumar B
Mega Sage
Mega Sage

@Deepika54 

Create a standard format for users to set the data in the email body

For example, Set the following format in the email body

callerID : Test User

ShortDescription : Testing Inbound

You can access the data from the body as below

var incCaller = email.body.callerID;

var incShortDesc = email.body.ShortDescription;

 

Anubhav24
Mega Sage
Mega Sage

Hi Deepika,

Please use the "email" object already provided. You can use this to get the body content in two ways : HTML or string format.

email.body_text: Contains the body of the email as a plain text string.
email.body_html: Contains the body of the email as an HTML string.

For other values form the inbound email , please refer below URL :

https://docs.servicenow.com/bundle/quebec-servicenow-platform/page/administer/notification/reference...