Our client is using Tridion 2011 with Workflow enabled for its documents publication. The specific versions, as requested:
Content Manager Explorer - Build 6.1.0.55920
Content Manager - Build 6.1.0.998
Update Version - Hotfix Rollup SDL Tridion 2011 SP1 - 1
When a user adds or edits a document, the Workflow gets a list of items that would be published and publishes them individually. That's to avoid package size too large error messages, since a document can be used on multiple publications (>70) on multiple pages.
The Workflow VB script in question
publishListXml = CreateObject("MSXML2.DOMDocument.6.0")
filter = TDSE.CreateListRowFilter()
Call filter.SetCondition("OnlyPublishedPages", True)
Call filter.SetCondition("OnlyPublishedCPs", True)
publishListXmlString = component.GetListPublishItems("tcm:0-4-65538", True, True, 1, filter) 'DEV PRODUCTION
Call publishListXml.setProperty("SelectionNamespaces", "xmlns:tcm=""http://www.tridion.com/ContentManager/5.0"" xmlns:xlink=""http://www.w3.org/1999/xlink""")
Call publishListXml.loadXML(publishListXmlString)
This works broadly fine, however it does trigger an "avalanche" of publishes, as other posts put it! We thought to resolve the avalanche with a custom resolver, since we believe GetListPublishItems
essentially triggers resolving.
However, the resolver is not called at this point - only when an item from this list is actually published, and it's too late then! We're including the Resolver here:
<add itemType="Tridion.ContentManager.ContentManagement.Component">
<resolvers>
<add type="Tridion.ContentManager.Publishing.Resolving.ComponentResolver" assembly="Tridion.ContentManager.Publishing, Version=6.1.0.0996, Culture=neutral, PublicKeyToken=360aac4d3354074b" />
<add type="ClientName.SDLTridion.CustomResolver.WorkflowResolver" assembly="ClientName.SDLTridion.CustomResolver, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7243500d1c9c3ace" />
</resolvers>
</add>
(since what we're publishing in this case is a Component). I have also added the resolver to the other item types, specifically to CommunicationManagement.Page
, CommunicationManagement.PageTemplate
, ContentManagement.Component
, CommunicationManagement.ComponentTemplate
, CommunicationManagement.Publication
, CommunicationManagement.StructureGroup
, and ContentManagement.Category
.
The resolver itself is presently just logging as below:
namespace ClientName.SDLTridion.CustomResolver
{
public class WorkflowResolver : IResolver
{
private static TemplatingLogger log = TemplatingLogger.GetLogger(typeof(WorkflowResolver));
public void Resolve(IdentifiableObject item, ResolveInstruction instruction, PublishContext publishContext, Tridion.Collections.ISet<ResolvedItem> resolvedItems)
{
log.Info("Resolver started");
if (IsDocumentWorkflow(item))
{
log.Info("Custom Resolver -- this workflow identified ... processing");
}
else
{
log.Info("Not document, don't care");
}
}
private bool IsDocumentWorkflow(IdentifiableObject item)
{
log.Info("Item title is " + item.Title);
if (item is Component)
{
Component component = (Component)item;
log.Info("Item schema is " + component.Schema.Title);
log.Info("Current IDRef " + component.Id);
log.Info("Lock type is " + component.LockType);
log.Info("Process is " + component.Schema.ComponentProcess.Title);
if (component.Schema.Title.ToLower() == "external document library" && component.LockType == LockType.InWorkflow)
{
return true;
}
}
return false;
}
}
}
The code works and creates entries in the log, but only when the Workflow script gets to publishing. When component.GetListPublishItems
is called, nothing is logged and it appears the Resolver is not called.
Firstly, have I included the resolver in the right place in the config (I don't see an entry for WorkItem
or similar)? And secondly, is this the right way to address the problem ... and thirdly, I guess, should it work in this circumstance?
component.GetListPublishItems
would trigger the Component resolver you have configured. But since you also filter on Published Pages, I'm wondering if perhaps you should try to configure your resolver on multiple items. Take a look at for instance the child Publications resolver I create a while ago (sdltridionworld.com/community/2011_extensions/…) that is actually enabled on all items but TargetGroup and Folder. So my suggestion would be to enable it on Pages too and see if you can debug the resolver.