Sitecore Workflow Auto Publish Media Items

Bhavik Patel • 7/3/2015

When you install a default Sitecore 7 instance, you will notice that there is a “Sample Workflow” already configured for you. The final step of this workflow has an “Auto Publish” action, which automatically publishes an item once it reaches the final step of workflow. How handy! If you take a look at the action, you’ll notice that Sitecore has some code to execute that action.

Auto Publish Parameters

For a project that I was recently working on, we decided we would leverage this code, as we wanted to perform an auto-publish of items when they were finally approved. We created our workflow and for in the final step, added an “Auto Publish” action with the same settings Sitecore provided in their sample workflow shown above.

After some testing, we noticed it worked quite well, publishing items as they were approved in our workflow. However, we quickly noticed that if we had image fields in our content items and uploaded new images, those images did not get published along with the item. That prompted me to look into the “Parameters” field of the “Auto Publish” action. As you may have noticed, there is a “deep” parameter specified for the action. Disassembling the code, I found that this parameter is used by the code to perform publishing of sub-items along with the item. Further analysis of the code led me to another parameter, namely “related”. This is used by the code to perform a publishing of related items along with the item. That was the ticket.

Auto Publish Parameters

So, in summary, to auto-publish newly uploaded media items along with your content items in workflow, using Sitecore’s “Auto Publish” action, make sure you provide the “related=1” parameter. Note that this option is only available in Sitecore 7 onwards, as the “Publish Related Items” option was not available in earlier versions of Sitecore.


Bhavik Patel

Sitecore Technical Architect

Bhavik Patel is a certified Sitecore developer who has held Sitecore Most Valuable Professional (MVP) status since 2015. He has more than a decade of experience with enterprise-class Sitecore and Microsoft .NET framework development, including Sitecore integration with SharePoint and Business Intelligence solutions. He leads our Sitecore development practice, engineering enterprise-class Sitecore implementations for Government and commercial sector clients. He's an expert at using Sitecore Helix Framework to create re-usable architectures, streamline the integration of front-end development and provide the foundation for SEO-optimized Sitecore marketing websites.

Explore topics:

Other Blog Posts from Bhavik Patel