0

I'm trying to control in which Publications an item is published when I publish in all child Publications.

What I developed is:

EventSystem.Subscribe<RepositoryLocalObject, PublishEventArgs>(PublshingWithChilds, EventPhases.Initiated);

private void PublshingWithChilds(RepositoryLocalObject item, PublishEventArgs args, EventPhases phase)
{
        if (args.PublishInstruction.ResolveInstruction.IncludeChildPublications)
            {
             ....
            }
}

This works fine when I send only one Component or Page to publish.

But if I try to publish a list of Pages or Components from the CME and I select "publish with childs", the first item has:

args.PublishInstruction.ResolveInstruction.IncludeChildPublications = true.

But all the other items that I sent to publish have:

args.PublishInstruction.ResolveInstruction.IncludeChildPublications = false

Is there another variable that contains that I selected "publish in child publications"?

Could I share the value of the first item with the others?

1
  • To clarify, you're saying you are selecting a number of pages and selecting "Publish in child publications" on that whole selection, but the flag is only set on the first item? Dec 23, 2019 at 11:36

1 Answer 1

1

I spoke with sdl support team and they explained that if I modify the value for args.PublishInstruction.ResolveInstruction.IncludeChildPublications it affects to all the items sent to publish in the same process.

I had to use ContextVariables to maintain a list of items and publications where the items were published.

Your Answer

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

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