Unable to deploy HTML email templates

Issue #463 resolved
Rick Cuddy created an issue

Trying to edit freeForm HTML emails.

  1. Pull HTML email templates from server.
  2. Edit content inside the template.
  3. Save.

Error: Deployment Failed: FIELD_INTEGRITY_EXCEPTION - <apex:page> is required and must be the outermost tag in the markup at line 1 column 1: Markup

This was working back in 1.7.3.3, and I believe in 1.7.4.3 but for some reason downgrading my version now requires me to re-enter my license key so I can't test back to a version it worked in.

Work around is to go back to Eclipse for this particular change, but I need to change the markup around the editable region quite frequently so this is pretty major for me.

Comments (13)

  1. Scott Wells repo owner

    Rick, let me try to reproduce the issue. Hopefully this is something quite simple.

    As for not being able to roll back to the earlier version, I recently updated the third-party library IC uses for licensing and it changes some stored information in a way that's not compatible with the previous builds. I'll definitely see if I can give you a solid solution as soon as I'm able to reproduce it.

    One quick thought, though...have you tried changing the API version in your connection to 36.0? I also recently updated the plugin for Winter '17 and the default API version is now 37.0. If you never changed it, it would automatically increment after the upgrade. It'd be interesting to see if this behavior is from an API version change...

  2. Scott Wells repo owner

    Rick, can you verify the value for <type> in the corresponding meta.xml file? Is it by chance visualforce? Any chance you could share the template that's causing the issue, or a simplified one that reproduces the problem?

  3. Rick Cuddy Account Deactivated reporter

    Hi Scott, Thanks for the quick reply.

    Tried setting the connection API back to 36.0, same issue.

    I tried creating a new template from scratch just to see if it was something weird with the ones that already exist, same issues.

    Please find related files:

    IC_Bug_Test.email

    <table border="0" cellpadding="5" width="550" cellspacing="5" height="400" >
    <tr valign="top" height="400" >
    <td tEditID="c1r1" style=" background-color:#FFFFFF; color:#000000; bEditID:r3st1; bLabel:main; font-size:12pt; font-family:arial;" aEditID="c1r1" locked="0" >
    <![CDATA[Editable content here]]></td>
    </tr>
    </table>
    

    IC_Bug_Test.email-meta.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <EmailTemplate xmlns="http://soap.sforce.com/2006/04/metadata">
        <available>true</available>
        <description>Testing email deployment for IC</description>
        <encodingKey>ISO-8859-1</encodingKey>
        <letterhead>Outbound_CCC</letterhead>
        <name>IC Bug Test</name>
        <style>freeForm</style>
        <subject>Test email</subject>
        <type>html</type>
    </EmailTemplate>
    

    Outbound_CCC.letter

    <?xml version="1.0" encoding="UTF-8"?>
    <Letterhead xmlns="http://soap.sforce.com/2006/04/metadata">
        <available>true</available>
        <backgroundColor>#FFFFFF</backgroundColor>
        <bodyColor>#FFFFFF</bodyColor>
        <bottomLine>
            <color>#FFFFFF</color>
            <height>0</height>
        </bottomLine>
        <footer>
            <backgroundColor>#FFFFFF</backgroundColor>
            <height>0</height>
        </footer>
        <header>
            <backgroundColor>#FFFFFF</backgroundColor>
            <height>0</height>
        </header>
        <middleLine>
            <color>#FFFFFF</color>
            <height>0</height>
        </middleLine>
        <name>Outbound CCC</name>
        <topLine>
            <color>#FFFFFF</color>
            <height>0</height>
        </topLine>
    </Letterhead>
    
  4. Scott Wells repo owner

    Thanks for the examples, Rick. I just added them to one of my own orgs and didn't reproduce the issue. I even did a retrieve after pasting in the exact file bodies again to see if anything had been changed on the server and things match perfectly. Obviously something odd going on here...

    Do you mind enabling some debug logging and capturing a log for me to review? Just add the following under Help>Debug Log Settings:

    #com.illuminatedcloud.intellij.builder.ForceComBuilder
    #com.illuminatedcloud.intellij.builder.ForceComToolingApiDeployer
    #com.illuminatedcloud.intellij.builder.ForceComMetadataApiDeployer
    

    and try to deploy this template so that it reproduces the issue. Then please send me your idea.log using Help>Show Log in Explorer/Finder. If you'd prefer to email it due to sensitive contents, you can do so at support@illuminatedcloud.com. Perhaps that log will help me understand any differences between our configs.

  5. Rick Cuddy Account Deactivated reporter

    Thanks Scott. I sent the log file to email. Though looking at the log, it seems to be under the assumption this file is in fact an ApexPage, and that there is no ApexPage with this name, so it tries to create it by posting to tooling/sobjects/ApexPage

  6. Rick Cuddy Account Deactivated reporter

    I'm going to try setting up a new project and see if the problem persists. Edit - no go, same issue in a fresh retrieve into a new project.

  7. Scott Wells repo owner

    Rick, thanks to your log I can see the issue. IC is seeing the email template as a Visualforce page due to the way it allows .email files to be treated as text, HTML, or Visualforce according to the meta.xml file. As a result it's trying to deploy it via the Tooling API as a page, hence the error message you're seeing. I should be able to put together a fix very quickly now that I understand the issue.

  8. Rick Cuddy Account Deactivated reporter

    My hero! That has deployed the template properly. Thanks for the quick turn around!

  9. Scott Wells repo owner

    Okay, glad to hear! Go ahead and sit on that test build and I'll let you know when I've released an official build with the fix...most likely Monday morning. Thanks for confirming!

  10. Log in to comment