Removing HTML From Email Description – Record Creation Rules

If an email is sent to a specific address, such as support@meganvwalker.com, a Queue in CRM can be used in conjunction with a record creation rule to create a new case (find out more here). This is a huge time saver and a great way to automate your system for your customer services team. However, one pesky little annoyance is how the body of the email, which you would typically want to use in the description field in your case, can look a bit funky depending on the originating mail client of the sender. For example, take the description in the screenshot below. Emails can be handled differently if they are sent from a Gmail account vs. Outlook or a mobile phone app. Here we see lots of markup and HTML. Not pretty right? So how can we go about removing HTML from the description?

Let’s work to get rid of that. We can do this with a workflow set up to run on the Case entity when a record is created. One of my favourite solutions is by Jason Latimer and that’s the CRM String Workflow Utilities. It has exactly what we need to take care of this, a Remove HTML option.

Set the property value of the case description field.

In the Update Case step, add the HTML Removed String step to the Description field on the case.

Here we go! Now we can see it’s taken out all of the HTML…. but what about those annoying break tags? They aren’t helping anyone, and would look much better with them gone right?

So back to our workflow, remove the update case step and add another of the options from the Workflow Utilities String, Regex Replace With Space.

Here we search the string we made previously, the HTML Removed String. You can set the number of spaces, and the use (<[^>]+>) as the pattern.

Add in an Update Case step at the end, and this time populate the description field with the final step, using the Replaced String instead of the HTML Removed String.

Hooray! Looks great right? Much easier to read. Thanks Jason! 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *