CRM 2013 – Convert Email HTML to Plain Text

I have had this request from a few customers over the years and it’s converting and using the description of an email is trickier than you initially think it will be.  This is a question which often appears on the CRM forum quite regularly as well.

The reason for this is although the email looks like plain text when you see it in CRM, when you get the value of the Email entity description (main body of the email) you will also get all the HTML tags.

The scenario I had when I was doing this was the customer wanted to convert an email into a case and get the values from description.

So to do this I had to strip out the HTML tags and a few other things, which I did using a plugin

if you have to do this here a couple

This blog post is excellent

http://ashwaniashwin.wordpress.com/2014/04/16/convert-html-to-plain-text-for-copying-email-message-in-crm-2011-2013/

C# code

http://aliraza.wordpress.com/2007/07/05/how-to-remove-html-tags-from-string-in-c/

A sample plugin

http://blogs.msdn.com/b/ukcrm/archive/2008/07/10/converting-html-e-mail-to-plain-text.aspx

 

Recently I saw Steve Green had created a CRM Video going through the process and  I thought I would promote the video on the blog because he also has a link to the code here https://dl.dropboxusercontent.com/u/4041841/CRMDemo2014.zip

 

 

I would also recommend anyone who wants to learn CRM development to go through Steve’s other CRM videos, many of them are in CRM 2011 but the code would still work in CRM 2013.

Advertisement

4 thoughts on “CRM 2013 – Convert Email HTML to Plain Text

  1. Raj Y Raman (@RajYRaman) September 29, 2014 / 11:43 pm

    Can’t we just add an IFrame to the form and inject the email’s html contents to it using JS? Eg. stackoverflow.com/questions/16504816/how-to-set-html-content-into-an-iframe-in-ie8-ie9

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.