Sitecore Continuous Integration DMS and the Marketing Centre

Hey all, as you know I'm a big advocate of implementing continuous integration or delivery for your Sitecore projects, in the Sitecore world much is made of the all important final step of the deployment being a Sitecore publish. 
We want to get the data from the master to the web database, then we can add steps to do automated web testing such as selenium testing etc, or deploy a package to DEV, UAT, PRD.
There are a few options to call a publish, you will probably have seen on many other Sitecore developers blogs,:
  • Use a publish.aspx page that calls the publish code.
  • Web service route, by calling Sitecore ship to initiate the publish and then call a ship endpoint and parse the response to check the late completed date to check for completion.
  • Use Sitecore rocks powercore powersell scripts to do it.
Most of the time calling the publish isn't the problem from a CI sense its knowing when its finished, my preference is the Sitecore ship approach, however we use the publish.aspx page simply because I found some code and it worked, and time is at a premium recently.
In any case, they will all achieve your end goal.

However something that is sometimes missed is the marketing center, when we create campaigns and goals on the site we have to deploy them using the review tab. 
This is important because until that point it doesn't exist in the Sitecore analytics database. 
When we click deploy we either get a pageeventdefinition row for a goal or a campaign row for a campaign created in the Sitecore analytics database.
From a Sitecore point of view this is important as if you have any personlisation defined that actions based on a campaign or goal being triggered, if it doesn't exist in the analytics db the rule wont action.
So we should really consider this when setting up continuous integration, for example here at SitecoreUK and Officecore we use TDS as part of our CI setup to deploy our serialized items into a vanilla sitecore installation. Some of those serialized items are goals and campaigns, TDS creates/deploys the items into the master database for us as part of the build, but it doesn't deploy them in the workflow sense, they will have a workflow state as deployed but that's just because it was serialized with that field value. From an analytics db point of view they don't exist because the code that fires when you action the deploy workflow state hasn't been called on your vanilla server. To that end we need to add an extra step to the CI process and that's to deploy all goals and campaigns first and then call the publish.

I'm going to share this code, and you can slap my hand for using hardcoded ID's, I know its wrong, and I'm sorry :P But hopefully this code will help you on your way. I will refine it when I have a bit more time I promise.
It gets all the campaigns, campaign groups and goals, loops through and sets the workflow state back to draft then to deployed. Finally it calls a publish. We have also recently added ucommerce to our demo application so we call a rebuild on the uCommerce search indexes.
Anyway I hope this helps, credit to Maras Musielak I used his answer here for the workflow bits:
http://stackoverflow.com/questions/18903060/execute-sitecore-workflow-state-actions-using-the-api



Comments

Popular posts from this blog

Sitecore Unicorn standard values field child ID warnings

Sitecore DMS and Analytics Considerations

Sitecore 8 Rebuilding historical path analyzer maps