locked
How to retrieve the body of an email template RRS feed

  • Question

  • Hi,

    I have a requirement to get the value of the body of email template and convert the contents of body to a word.
    Using sdk when i retrieved the body of the email template,am getting the body as below.This is in an XML format.
    Whether anyone knows how to convert this xml format to html format or how to convert this to a word.
    The one which is in bold is actual values which are in the body.


    <?xml version="1.0" ?><xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:output method="text" indent="no"/><xsl:template match="/data"> <![CDATA[<p>Dear ]]><xsl:choose><xsl:when test="lead/firstname"><xsl:value-of select="lead/firstname" /></xsl:when><xsl:otherwise></xsl:otherwise></xsl:choose><![CDATA[,</p>  <p>Thanks for your interest.</p>  <p>Regards,</p>  <p>]]><xsl:choose><xsl:when test="lead/new_accountmanagerid/@name"><xsl:value-of select="lead/new_accountmanagerid/@name" /></xsl:when><xsl:otherwise></xsl:otherwise></xsl:choose><![CDATA[</p>]]> </xsl:template></xsl:stylesheet>


    Thanks,
    Kishen

    Monday, December 13, 2010 9:42 AM

Answers

  • My first question would be "why are you extracting the text"?  If it is so that you can "mock" the resultant format/layout of the email template, I think your best bet is to mock the process by which the CRM uses the email body field.

    It is an XSL transformation document; and it is designed to transform an XML document with a structure similar to the following:

    <data>
     <lead>
     <firstname>Fred</firstname>
     <new_accountmanagerid name="Mr Account Manager" /></lead>
    </data>
    

    So you could mimic the transformation by instantiating an XML Document with the above content; then transforming it with the XSL transform in the email body.

    See here for some sample XSL transformation code.


    --pogo (pat)
    Monday, December 13, 2010 11:14 PM

All replies

  • Hi Kishen,

    check following article ..see if this helps..

    http://www.codeproject.com/KB/XML/XML_to_HTML_Convertor.aspx

     


    MayankP
    My Blog
    Follow Me on Twitter
    Monday, December 13, 2010 2:43 PM
  • My first question would be "why are you extracting the text"?  If it is so that you can "mock" the resultant format/layout of the email template, I think your best bet is to mock the process by which the CRM uses the email body field.

    It is an XSL transformation document; and it is designed to transform an XML document with a structure similar to the following:

    <data>
     <lead>
     <firstname>Fred</firstname>
     <new_accountmanagerid name="Mr Account Manager" /></lead>
    </data>
    

    So you could mimic the transformation by instantiating an XML Document with the above content; then transforming it with the XSL transform in the email body.

    See here for some sample XSL transformation code.


    --pogo (pat)
    Monday, December 13, 2010 11:14 PM