Sitecore Weekly Tips – Tip 5: workaround a bug to select emails from multiple email manager roots in the Sitecore 9 Marketing Automation engine.

I worked with the new Marketing Automation engine for several months now and recently encountered a bug. The scenario is as follows: I have a multi site setup (obviously created with SXA) and for each site I have a separate EXM mail manager root. I created several emails in each mail manager root which I use in one of my Marketing Automation campaigns.

One of the first actions of my Marketing Automation campaign is to send an email and from there check if that specific email was opened. So I used a Send email action and saw all of my configured emails. So far so good.

But I got stuck in the Custom listener action. I added a rule to check if the specific email was opened but could only select emails from the default EXM mail manager root.

The workaround

There are two things you can do. One is to use the search option and search for emails. But it is not the most user friendly one. The other one is changing the rule a bit. Let’s look at the rule:

If you browse to /sitecore/system/Settings/Rules/Definitions/Elements/XConnect – E-mail/ you will see the rule in the Text field as follows:

where the contact opened email [ItemId,Tree,root=/sitecore/content/email, email]

The part between the square brackets is the most interesting part. You can see that there is a parameter called root. It is sort of hard coded to the path /sitecore/content/email, so that is the reason why you cannot see or use other mail manager roots. If you remove the email part and test the rule you will see the following:

Cool! You will now see everything directly under the Content node. Although this is a step forward, it is still not the ultimate solution. If you look at the image above you also see a Home item as well as Tenant and Tenant Folder and everything below those items.

What I really want is to only see the mail manager roots or the elements below the mail manager roots. Luckily, there are some parameters you can use to scope the tree a bit.

This is how my changed rule looks like:

where the contact opened email [ItemId,Tree,root=/sitecore/content&selection=System/Email/Messages/ImportFromHtml&display=Common/Folder|System/Email/Manager Root|System/Email/Messages/Messages Container|System/Email/Messages/ImportFromHtml, email]

I have added two parameters after the path in the root parameter. Those are selection and display. As from what I understand the selection parameter tells the tree which items can be selected. With the display parameter you can tell the tree which templates it can show. The rest is hidden, so it is a sort of filter mechanism. With this customized rule my selection dialog box now looks as follows:

Aaahhh, finally I can see two mail manager roots and all the folder structures below.

Some things to notice

There are a few things you have to be aware of:

  • First of all, you should always make a copy of the existing rule instead of changing a default one.
  • Secondly you have to include each mail item template in the selection and display parameters, otherwise you cannot use them. In my example I only included the ImportFromHtml one, because I create my local test emails via an HTML file.
  • Do not forget to include any other template as well, otherwise you will not be able to navigate through the whole tree. In my example I have included the Common/FolderSystem/Email/Manager Root and the System/Email/Messages/Messages Container templates so the user is able to open the whole tree until the actual emails can be viewed.

That being said, it is actually a nice workaround to give your marketers a more user friendly way of selecting any email from any mail manager root. Notice that this is not a fix! This bug is reported at Sitecore and hopefully fixed in upcoming releases.