1

I've a case where there is a sitecore parent item is in a workflow state and in the final workflow state, parameters are set to deep=1&related=1&alllanguages=1. The scenario here is that the child items are also in any sitecore state (Except final workflow state). When Parent item gets published, the Child items do not.

I discussed this problem with few sitecore experts and their opinion is different regarding this behaviour. Some says this should not be the case, despite of the child item's current state it should publish them and some says this is exactly sitecore should behave (I support this side :)).

Can some one please help me to end this discussion with facts.

Thanks, Arun

2 Answers 2

2

I am assuming you are not using any custom publishing action and using OOTB auto publish implemented via Sitecore.Workflows.Simple.PublishAction, Sitecore.Kernel. This publish action uses the below parameters -

  • Item = The item to publish, where workflow action is being used
  • targets = Target database/s
  • languages = The languages, an item needs to publish
  • deep = controls whether children of the current item will be published. Possible values: "1" - children of the current item will be published; all other values - children of the current item will not be published.
  • compareRevisions = Compare revisions if set to 1
  • publishRelatedItems = Publish related items if set to 1

If you will see the code of simple publish action, innerItem's parameters are converted into NameValueCollection to get each param -

  NameValueCollection urlParameters = WebUtil.ParseUrlParameters(innerItem["parameters"]);
  bool deep = this.GetDeep(urlParameters, innerItem);
  bool related = this.GetRelated(urlParameters, innerItem);
  Database[] array1 = this.GetTargets(urlParameters, innerItem, dataItem).ToArray<Database>();
  Language[] array2 = this.GetLanguages(urlParameters, innerItem, dataItem).ToArray<Language>();
  bool compareRevisions = this.IsCompareRevision(urlParameters, innerItem);

But if the child items are not in the final workflow state these will not publish, all you need to add some custom action to programmatically approve the child items and put them in the final workflow state and publish.

2

#2 case is correct. Child items will not publish if they are not in the final workflow, that's how Sitecore workflow works.

Let's suppose you have some child items and don't want to publish them what will you do if case #1 will happen, it will publish those unwanted items as well.

But if you want to publish a child with a parent then you would need to write a custom approval action that checks all related items when the main item is approved and sets the workflow of the related items (or subitems) to the approved state.

Here's one example of how this could be done: http://sitecorepromenade.blogspot.com/2015/10/workflow-with-auto-publish-related-items.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.