Send last comment to email

MartinV
Tera Contributor

Hi, 
I have a flow that sends an email when someone writes a comment in a work order task. I am sending template message with the number of the WOT. When I reply to that email, the text gets sent to the activity of the WOT.

Here is where the problem starts. I tried adding the actual comment to the body of the email via data pill , however the flow returns and error "invalid body html". 
Then I tried a different approach, by adding a custom action with a script step that pulls the comment, but it didn't work either. Is there a way to pull the last message from the activity to the mail body?


The idea of the whole thing, you write a comment in the WOT - a mail gets send to a defined recipient, e.g. a contractor. He sees that message, and replies back via the email. Everything works, except for the comment not being sent. I would appreciate if you point me to the right direction. 

Thanks!

1 ACCEPTED SOLUTION

@MartinV 

this is some other error about invalid HTML

see these links

Email validation failed: Email body comprised of invalid HTML 

Send email Action in flow designer fails with the error "Email validation failed: Email body is comp... 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

View solution in original post

8 REPLIES 8

Ankur Bawiskar
Tera Patron

@MartinV 

share some screenshots

 

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

MartinV_0-1777538824053.png

MartinV_1-1777538876748.png

This error occurs whenever I select a comment or a work note via data pill and put it into the body. 
I also tried using a custom action with a script that pulls from the sys_journal_field table, but the outputs were empty. 

@MartinV 

this is some other error about invalid HTML

see these links

Email validation failed: Email body comprised of invalid HTML 

Send email Action in flow designer fails with the error "Email validation failed: Email body is comp... 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

Thank you for your reply! I changed glide.email.body_html_validation_rule value to "none" and finally received the comments / work notes in the email. Now I just need to figure out a way to pull the latest ones, because the flow pulls all of them from the WOT and sends them to the email. Probably will have to use a custom action with scripted step for this.