Embed Image in CRM 4.0 templates
In my current engagement, there was a requirement to embed images in email template. Now, as it is very well known that you can easily achieve it by copy pasting the HTML to CRM's Rich Text Editor. Most of the times it works fine. But then if it goes normal all the times I won't have to blog about it right? so.. here it goes..
In our case, we had a sample word document which had an image on top and some formatted text. As soon as this came to me, I fired up CRM's web UI and created a blank template. I created an HTML file out of word document. After opening the html file and copying/pasting, it worked fine and template got saved without any issue. Once the template was in place, I tried to apply it to an email activity. It worked fine, I could see the formatted text, the image on top and the layout was also preserved. Happily I clicked on Save button and.... whoooooshhh... it was gone.. the image was gone, everything else was there, but the image was gone. So there I was, the only thing I needed to close today to have a nice weekend was this email template fix. Also one of my colleague was working on this and he did a lot of research eliminating many other possibilities why it won't work. After few more minutes, I made a blank html page, added a nice Windows Live Logo and repeated the copy/paste on the same email template. Once it was done, I applied to the same email and voila.. it worked. So it was pretty clear that it was all due to the HTML that we were using for the template.
I always keep IE Dev Toolbar available, so I fired it up, and clicked on Validate -> HTML. The online HTML validator showed me there were some minor issues with the HTML. I corrected them and removed word HTML tags in which my IMG tag was wrapped. After this I followed the process copy/paste and test and .. there it was a .. working email template with an image.
Also it was very clear that we will have to find out a structured process to do it as there will be more templates coming soon. I might come up with an automation process, if you are interested keep watching this blog or drop me an email, if you need it urgently.