WebEdit.AffectWorkflowForDatasourceItems – collect datasource children items

This feature appeared in Sitecore 8.2, which is changing the workflow state value for datasource items together with the context page item (only in Experience Editor). Here is a great summary article related to these improvements.

I was not fully satisfied with this because by default this only collects the datasource items and does not the children items of a datasource. This is an issue when you have something like a list component which shows the children items. What I have found is:

name="webedit:workflowwithdatasourceitems" type="Sitecore.ExperienceEditor.WebEdit.Commands.WorkflowWithDatasourceItems, Sitecore.ExperienceEditor" />

So I just needed to overwrite this command and put my logic there:

using Sitecore;
using Sitecore.ExperienceEditor.Utils;
using Sitecore.ExperienceEditor.WebEdit.Commands;
using Sitecore.Workflows.Simple;
using System.Linq;
namespace Helix.Skeleton.Foundation.ContentWorkflow.Commands
public class WorkflowWithDatasourceItemsAndChildren : WorkflowWithDatasourceItems
protected new void WorkflowCompleteCallback(WorkflowPipelineArgs args)
var datasources = ItemUtility.GetItemsFromLayoutDefinedDatasources(
foreach (var child in ItemUtility.FilterSameItems(datasources).SelectMany(d => d.Children))
if (child.Access.CanWrite() && (!child.Locking.IsLocked() || child.Locking.HasLock()))

And the related config what I have mentioned above:

<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<command name="webedit:workflowwithdatasourceitems" type="Helix.Skeleton.Foundation.ContentWorkflow.Commands.WorkflowWithDatasourceItemsAndChildren, Helix.Skeleton.Foundation.ContentWorkflow" />

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s