How to copy HTML content from email body to "description" of incident form? inbound action

Vdix
Tera Guru

Hi all,

How to copy HTML content from email body to "description" of incident form?

 

we have following fields in the email body -:

 

Start date 

Application environment

Error description 

Application version

Sender Code.

 

and now they want the start date, Application version & Application environment  in the description field of incident. How can I achieve this .

 

Thanks,

 

 

 

 

 

 

 

 

4 REPLIES 4

Voona Rohila
Kilo Patron
Kilo Patron

Hi vibha

 

What did you try so far? 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Hey Rohila,

 

I have created the following script for getting one variable value, now I am stuck to get the value from other HTML.

 

var messageBody = email.body_text;

var startIndex = messageBody.indexOf('Application environment') + 20; // the size of this string;
var endIndex = messageBody.indexOf('Error description ', startIndex);
var myString = messageBody.substring(startIndex, endIndex);

//now remove any white space
myString = myString.trim();
current.description=myString;

 

 

Hi Vibha

 

Can you share the email format?

 

Are they coming in the format you mentioned above or is it like

Start date : <<some value>>

 

 


Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP

Saurav11
Kilo Patron
Kilo Patron

Hello,

 

Are they always coming in this format and is it like Start date : some value? i.e varibale value format? I ye syou can us the below

 

current.description=email.body.Start date+ email.body.Application environment+  email.body.Application environment.Application version

 

For more information please check the below article:-

 

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

 

Please mark my answer as correct based on Impact.