Remove '&#39' from email body inbound email action

Richard Thomas2
Tera Contributor

Hi experts,

I'm trying to remove the apostrophe from an inbound action email body. I've tried various script which have a variation of;

var messageBody = email.body;
messageBody = messageBody.replace(/'/g, ' ');
 
var messageBody = email.body;
messageBody = messageBody.replace(/'/g, ' ');
 
Nothing seems to work. Does anybody have any experience of removing things like this from inbound emails?
 
Thanks as ever
 
Richard
 
 
2 ACCEPTED SOLUTIONS

Hi @Richard Thomas2 

Thanks for the input, try the one below.

var messageBody = email.body_text;
messageBody = messageBody.replaceAll("'", '"').replaceAll("#39;", '"');

 

Please mark my answer helpful and accept as solution if it helped you 👍✔️

Thanks,
Anvesh

View solution in original post

I tried this in Background script, it was working 😀 Keep exploring.

 

AnveshKumarM_0-1695817662999.png

 

Thanks,
Anvesh

View solution in original post

8 REPLIES 8

Richard Thomas2
Tera Contributor

Neither of these work unfortunately guys - thanks for your help though - I'll keep trying 🙂

I tried this in Background script, it was working 😀 Keep exploring.

 

AnveshKumarM_0-1695817662999.png

 

Thanks,
Anvesh

Ah ok! That's promising. Thank you 🙂

 

This is correct! Apolgies - I was must've entered it incorrectly initially. Thank you 🙂