Removing HTML From Email Description – Record Creation Rules


If an email is sent to a specific address, such as, 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! 🙂

2 thoughts on “Removing HTML From Email Description – Record Creation Rules

  1. Megan,

    Great article. It really helped me out. I didn’t know about Jason Latimer’s string toolset, I can see it really being useful as I set about sorting out our CRM system.

    One thing I found was that I had to expand the workflow a little as it was not stripping those annoying tags out.

    Basically my workflow is 4 steps:
    1 – Remove the HTML using the “Remove HTML” utility
    2 – Put the resulting text back from Step 1 back into the Case Description field using the {HTML Removed String(Remove HTML)}
    3- Replace the breaks with spaces using the “Regex Replace With Space” utility but using the now mostly HTML free text from the Case Description field again
    4 – Put the resulting text back from Step 3 back into the Case Description field using {Replaced String(Replace Breaks with Spaces)}

    A bit clunky but it appears to work.

    Thanks again

    1. Hi Dave, thanks for the comment! So part of the post has that same step, to get rid of those really annoying tags… so I think my final workflow detailed should be the same as what you came up with. It’s great that we can use something like this utility from Jason. He’s amazing!

Leave a Reply

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

Recent Articles