onsdag den 22. oktober 2014

Working around Sitecore ECM 2.1 creating newsletters with identical paths in the content tree

When using the ECM 2.1 module to create newsletters in Sitecore, there seems to be an unfortunate problem.

When the newsletter is created, it is done by creating an item in Sitecore, named after the branch it is created from - and if not changed, it will stay with this name.

This is a problem, if you are inserting controls in the newsletter, that uses the path of the newsletter as it source, since it then will not be able to find the right datasource.

Already, newsletters are placed into folder, that is named after their creating timestamp, so that helps a bit on the problem - if there only is one newsletter in each folder with the same name.

But since ECM doesn't know that it should do that, there is a workaround for this - it's an ugly hack, but it works.

Create an include file, and name it so it gets loaded after Sitecore.EmailCampaign.config (like this: Sitecore.Support.422404.config - named after the support issue I got this workaround in).

Paste this into the config file, and same it:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:x="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <settings>
      <setting name="MaxMessageFolderSize">
        <patch:attribute name="value">1</patch:attribute>
      </setting>
    </settings>
  </sitecore>
</configuration>

Thats it - then it creates a new folder for each newsletter, which ensures there never is duplicate paths.