Interaction Description replaced with text (please use an email client that supports HTML)

EthanY
Tera Contributor

Hi,

We have a flow that triggers on an inbound email to convert it into an Interaction. I'm trying to ingest a particular email, but when the flow is triggered and it converts this email into an Interaction, it is replacing the Description with the following text: "(please use an email client that supports HTML)"
No other emails are having this problem, just this particular email I'm trying to get working.

This is the action being triggered that populates the Description of an interaction based on an email:

/**
 * The Regex is looking for any of these 3 patters and replacing them with nothingness for inbound Interaction emails
 * "[mailto:"..."]",
 * "[https://links.dc2.pageuppeople"..."]" 
 * "<"...">"
 **/

var subject = fd_data.trigger.subject;
var email_text_with_html = fd_data.trigger.body_text;
var email_text = email_text_with_html.replace(new RegExp('(?:(\\[mailto:|\\s\\[https:\\/\\/links\\.dc2\\.pageuppeople).+?\\]|<.+?>)', 'gm'),"");
var description = "Email Subject : " + subject + "\n\n" + email_text;
return description;

 
Checking the execution triggers, if I open the Inbound Email, "Body" contains the following: (Have replaced IP Addresses with fake text)

<ol><li><strong>N1.02 - Lab Room</strong> - <a href="FAKE TEXT">FAKE TEXT</a> - DeviceCheckin - [Failed to checkin. Last seen 32m 20s ago.](0ms ago)</li></ol><p>The panels listed above may need attention. Go to <a href='FAKE TEXT'>FAKE TEXT</a> for more information.</p><p>There will be no more notifications for the next 24 hours unless an error condition clears and then faults again within that time.</p><p><small><em>Concierge Companion 2.3.303</<em></small></p>

yet Body Text returns the runtime value of "(please use an email client that supports HTML)"
According to the SN Inbox, the Content type of these emails is 'multipart/mixed'

Looking at logs, this error pops up around the time the flow is triggered: The requested flow (canRead on element dot walk from sys_email:af2ad6af83f1a6107d4543547daad3b9) operation was prohibited by security rules.
But we're having problems trying to locate what security rule is being prohibited from running, that sys_id does correlate to the email being ingested though, so it seems to be related.

Any ideas what is causing this? Or ideas on how I can get Interaction Description to populate based on the Body instead of Body Text for these particular emails?

I'm still new to ServiceNow Developing and learning as I go, so hopefully this makes sense, and thank you in advanced for any help.

1 ACCEPTED SOLUTION

EthanY
Tera Contributor

Managed to get around it.
In the flow in the step before the action that generates the description, added a lookup that checks for the email record, then altered the script slightly to say if it's this particular email, populate description using body instead of body_text.

var subject = fd_data.trigger.subject;
var email_text_with_html = fd_data.trigger.body_text;
if(subject=='Concierge Companion: Panels require attention (companion)')
{ email_text_with_html = fd_data._30__look_up_record.record.body;}
var email_text = email_text_with_html.replace(new RegExp('(?:(\\[mailto:|\\s\\[https:\\/\\/links\\.dc2\\.pageuppeople).+?\\]|<.+?>)', 'gm'),"");
var description = "Email Subject : " + subject + "\n\n" + email_text;
return description;

View solution in original post

5 REPLIES 5

EthanY
Tera Contributor

Managed to get around it.
In the flow in the step before the action that generates the description, added a lookup that checks for the email record, then altered the script slightly to say if it's this particular email, populate description using body instead of body_text.

var subject = fd_data.trigger.subject;
var email_text_with_html = fd_data.trigger.body_text;
if(subject=='Concierge Companion: Panels require attention (companion)')
{ email_text_with_html = fd_data._30__look_up_record.record.body;}
var email_text = email_text_with_html.replace(new RegExp('(?:(\\[mailto:|\\s\\[https:\\/\\/links\\.dc2\\.pageuppeople).+?\\]|<.+?>)', 'gm'),"");
var description = "Email Subject : " + subject + "\n\n" + email_text;
return description;