Inbound action not taking email body for created interaction record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2023 08:51 AM - edited 12-18-2023 08:51 AM
I am trying to create an inbound action that creates an interaction record. My problem is this code:
u_description = 'Email body: ' + email.body_text
does not get the email body and 'Description' on the Interaction is blank except for the 'Email body:' prefix.
This snippet seems to be the accepted way of doing it and i'm lost as to what is going wrong when the other fields are being populated fine. I also know that it will take the html and populate Interaction description with that if i use
email.body_html
but thats not really useable. Also if i gs.log(email.body_text) it shows nothing.
I have tried both of these approaches:
Any help is appreciated
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2023 10:09 AM
Hi @Mike62 ,
The code seems ok to me, just ensure this custom u_description field type should be string type.
If inbound action is running on interaction table the you don't need the code with GlideRecord, first one is good.
Tyr to add gs.log for email.body_text and check if body data, also you can try to set this email.body_text in comment or work notes for testing. Let's see if its adding there or nor.
-Thanks,
AshishKMishra
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2023 10:20 AM - edited 12-19-2023 02:41 AM
E-mails can contain text and HTML variant or either one of those.
Probably those e-mails are sent only with HTML contents.
It depends on the sender.
If the sender does not instruct the mail agent (application) to also include a plain text version of the e-mail body, only HTML content will be sent.
In that case, if you don't want to use the HTML content, you need to convert the HTML into plain text yourself.
A simple, poor man's quick solution - but not yielding the best results - would be:
new GlideSPScriptable().stripHTML(email.body_html)
A more complex, much harder to implement, but yielding as good of a result as you want to, would be implementing library HTMLParser and adopting adapting it to parse HTML and make it into simple text.