remove the unwanted content in inbound emails

Prerana1
Kilo Guru

Hello Guys,

We have created the inbound actions to create the ticket when OTRS tool send an email to Servicenow but along with the mail the extra content is also updating in the ticket( see the print screen) i want to eliminate the extra content and to keep only the main content, i have written a code but no luck.

Can anyone guide me with this Please?

find_real_file.png

find_real_file.png

Thanks and Regards,

Prerana

1 ACCEPTED SOLUTION

Hello Prenana, I tried with another approach and it worked:


var body = email.body_text;


var expectedTxt= body.split("Bitte denken Sie an")[0] ; // add your line here or keep 4 words

gs.log("expectedTxt: "+expectedTxt);

Thank You!
Abhishek Gardade
ServiceNow MVP 2020

Thank you,
Abhishek Gardade

View solution in original post

13 REPLIES 13

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Prerana,

it looks you are trying to replace the variable fakeText rather than the string itself

It looks you are testing it in the script itself?

how would you know till what length the text is fake and from which point the real text starts

Do you have some identification parameter?

Regards
Ankur

 

 

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hello Ankur,

Thank you so much for the reply.

We dont want that fake text to be updated in the description field and apart from the text indicated in the arrow everything should be updated in the description but not the fake text( The extra content)

Can you please suggest me where i am wrong, they have sent few sample email to test instance for our reference

find_real_file.png

Thanks,

Prerana

Hi Prerana,

If the fake text will always form a pattern and start with some particular message then proceed with what Abhishek has mentioned

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

AbhishekGardade
Giga Sage

Hello Prenana,

Go to System Properties> Email Properties and add what you need to the Inbound Email configuration property labeled.

Discard everything below this text if found in a reply body (comma separated, case sensitive).

find_real_file.png

Add your text start line(Bitte denken.........) here: 

Refer below Docs,

https://docs.servicenow.com/bundle/jakarta-servicenow-platform/page/administer/reference-pages/refer...

Please mark as Correct Answer and Helpful, if applicable.
Thank You!
Abhishek Gardade
ServiceNow MVP 2020

Thank you,
Abhishek Gardade