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

Bhavik is a .NET developer with over 9 years of experience, focusing on Sitecore CMS for the last 3 years. He has worked on several Sitecore CMS projects in both single-site and multi-site scenarios, and truly enjoys how extensible it is. He has a passion for problem solving and using technology to create engaging websites and applications. Bhavik is a Sitecore Technology MVP, 2015 and 2016.

Explore topics:

Other Blog Posts from Bhavik Patel

Subscribe for insights, trends and big ideas