- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2024 06:10 AM
Can anyone help me write a script to resolve this error:
Email validation failed: Email body is comprised of invalid HTML.
It is generated in Flow Designer when there are invalid tags in an HTML email reply.
I'm using the 'Send Email' action to send staff a notification when an email reply is received on a ticket.
I think this needs a Regex script?
Help is greatly appreciated!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 10:28 AM
Clean HTML- Flow Designer Action
Create a FD Action with Input:
Script Step:
Script:
(function execute(inputs, outputs) {
// Input variable
var htmlString = inputs.htmlString;
// Remove HTML tags using regular expressions
var cleanString = htmlString.replace(/<br ?\/?>|<\/p>/ig, "\n");
cleanString = cleanString.replace(/<script[^>]+>.*<\/script>/ig);
cleanString = cleanString.replace(/<style[^>]+>.*<\/style>/ig);
cleanString = cleanString.replace(/<[^>]+>/g, "");
// Output variable
outputs.text_out = cleanString;
})(inputs, outputs);
Create Action Output:
Call the FD Action from the FD Flow:
(this will get the latest email response)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2024 06:21 AM
Hi @Su522 ,
Refer below post.
Please check and Mark Helpful and Correct if it really helps you.
Regards,
Mayur Shardul
ServiceNow Rising Star 2024
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2024 07:07 AM
Hi,
Unfortunately, I've read that article and it is not helpful. Can you elaborate on how to fix this? With scripting.
How can we actually fix this, details needed please
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2024 10:28 AM
Clean HTML- Flow Designer Action
Create a FD Action with Input:
Script Step:
Script:
(function execute(inputs, outputs) {
// Input variable
var htmlString = inputs.htmlString;
// Remove HTML tags using regular expressions
var cleanString = htmlString.replace(/<br ?\/?>|<\/p>/ig, "\n");
cleanString = cleanString.replace(/<script[^>]+>.*<\/script>/ig);
cleanString = cleanString.replace(/<style[^>]+>.*<\/style>/ig);
cleanString = cleanString.replace(/<[^>]+>/g, "");
// Output variable
outputs.text_out = cleanString;
})(inputs, outputs);
Create Action Output:
Call the FD Action from the FD Flow:
(this will get the latest email response)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2025 02:27 AM
Hi @Su522 ,
I am facing the same issue in my flow designer. Hence, the flow is failing. Just need to know where have you put the new created action in the flow ? Have you used it instead of Send Email ? Can you just brief a little more on the steps.