Workflows: Submitting a Page along with Associated Components

A unique workflow request was made on one my projects.  The user wants the ability to submit a page along with its associated components.  Since I was sure this could be a pretty common request.  I asked Google to find me a possible solution and it found Jason Woods’ blog post from May of 2016 titled “Submitting a page to workflow with associated components“.  Thank you, Jason, for that post, it saved me a lot of time.  Jason also mentions this may have been resolved in Sitecore 8.2, but unfortunately we aren’t able to upgrade this site at this point.

As you’ve read in previous posts, you know I tend to get some odd requests that make it difficult to use other developer’s solutions and this is no different.

My requirements:

  • Administrators trump lock owners
  • This action needs to be used under multiple workflow states, so hardcoding of the next state is not an option.
  • Enforce Lock Owner is undefined so we’ll add that functionality just in case..

Step 1: The Workflow Action Template

I made a copy of the Auto Submit Action located “/sitecore/templates/System/Workflow/Auto Submit Action”.  I then removed the Role Name field and added a checkbox field “EnforceLockOwnership”.  The purpose for the EnforceLockOwnership field is for when you want the author to be able to submit only their locked items and not another author’s.

Step 2: The Code

I created 4 files.

The always popular Extension Methods (Refactored, but based on Brent Svac’s post):

The Interface:

The Action Base:

The Action:

Step 3: Create this action under the appropriate Workflow Commands

I created this new action under the Draft state -> Submit command of my Workflow.  It looks like this:
Workflow Action Item The Workflow Action Field Values

Thanks for reading.