marketing Automation deploying Sitecore How-To

Sitecore 9: Deploying Activity Type to Sitecore UI and Marketing Automation engine

As a result of previous efforts we have the following assets ready for deployment:

  • Demo9.Features.dll - assembly that has activity type backend implementation
  • Sendpromoemail.plugin.js - bundled UI components
  • Activity definition item in Sitecore.

First we need to deploy assembly to Marketing Automation engine by uploading it to

Next we need to register our newly created activity type in configuration. We can create an xml patch file.
<XConnectRootFolder>\App_data\jobs\continuous\AutomationEngine\App_Data\Config\sitecore\ MarketingAutomation_patch\sc.MarketingAutomation.ActivityTypes.xml

    Marketing Automation activity type registrations.
                    <Type>Sitecore.Xdb.MarketingAutomation.Locator.ActivityTypeRegistration, Sitecore.Xdb.MarketingAutomation</Type>
                        <ImplementationType>Demo9.Features.MarketingAutomation.Activities.SendPromoEmailActivity, Demo9.Features</ImplementationType>

Make sure you set ID to the item ID of the action type definition. Note that node name like
MarketingAutomationDemo.Activity.SendPromoEmailActivity is up to you but make sure it is unique across all activity definitions.

Next, we need to deploy and register our UI bundle with Marketing Automation UI.

First upload Sendpromoemail.plugin.js to the following folder:
As suggested by documentation we need to create the following patch file to register plugin within Sitecore.

<?xml version="1.0"?>
<configuration xmlns:patch="" xmlns:set="" xmlns:role="">
    <sitecore role:require="Standalone or ContentManagement">
        <demo9 path="./plugins/sendpromoemail.plugin.js"/>

All good, now it's time to test.

Navigate to Marketing Automation Editor. Sitecore will try to load custom plugin with SystemJS and will most likely fail in the default setup with the following error:

marketing Automation

In the console you can find the following error:

main.26a730503150bac385ab.bundle.js:1 Error: Unexpected token <
  Loading ./plugins/sendpromoemail.plugin.js
    at eval (<anonymous>)

You can quickly figure out that SystemJS tried to load script and was redirected to Sitecore login page. There are no cookies supplied by SystemJS, and so request to load plugin does not pass forms authentication enabled for Sitecore folders. As a workaround, we can grant access to /plugins folder by adding the following configuration to web.config

   <location path="sitecore/shell/client/Applications/MarketingAutomation/plugins">
        <allow users="*"/> <!--this will allow access to everyone-->

If everything was done correct, you will find your custom action in Plan Editor Toolbox under Marketing actions.

marketing Automation

You can drag and drop it to the plan editor and click on the action to make sure editor loads fine. Remember we created very basic read only editor that only shows a label.

marketing Automation

In the next post, I will create a more advanced activity type with parameters and multiple paths. I will also make use of activity services and Interaction data in the backend implementation.

You can find full source code on GitHub

Fly high with Sitecore 9.