
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2022 02:40 AM
Hi,
As usual, I'm working on inbound actions. We have an email that comes in from a device but it was set to put the alert text on a separate line which means the usual "name:value" set up won't pick it up.
I found this post about how to remove carriage returns from a string and it works in a background script but when I put it in an inbound rule and reprocess an email that fits the trigger, my log shows it as "undefined". Surely the syntax should be then same?? What am I doing wrong?
if (email.subject.indexOf('CKM00130702342/172.20.128.2')>-1){
email.body = email.body.replace(/\s+/g,'');
email.body = email.body.replace(/CN=/g,'');
gs.info('XXBody: ' + email.body);
}
Log:
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2022 05:12 AM
Hi Andrew,
email.body is an object and not a string so replace won't work in this case
You will need to use email.body_text to replace the carriages
if (email.subject.indexOf('CKM00130702342/172.20.128.2')>-1){
email.body_text = email.body_text.replace(/\s+/g,'');
email.body_text = email.body_text.replace(/CN=/g,'');
gs.info('XXBody: ' + email.body_text);
}
Hope this helps,
Shane

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2022 05:03 AM
Hi Andrew,
Can you provide a sample of the email body text & html versions?
Kind Regards,
Shane

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2022 02:01 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2022 05:12 AM
Hi Andrew,
email.body is an object and not a string so replace won't work in this case
You will need to use email.body_text to replace the carriages
if (email.subject.indexOf('CKM00130702342/172.20.128.2')>-1){
email.body_text = email.body_text.replace(/\s+/g,'');
email.body_text = email.body_text.replace(/CN=/g,'');
gs.info('XXBody: ' + email.body_text);
}
Hope this helps,
Shane

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2022 02:03 AM
You are a gentleman and a scholar (and an acrobat).
Thank you. Works a treat.