Publishing Tridion Using Code (PublisherFramework)

I am trying to publish a page during Workflow. There are two environments that we publish during the workflow process: one for testing and one for life. During the first automatic activity, we publish for testing, and during this process, the Components on the pages do not need approval. We got it for work.

However, when we claim that the page and page are published for life, we need to make sure that we publish only approved components (i.e. major versions).

In my code, I use the Page.Publish method, but with this I cannot indicate that it should publish only approved elements.

The publish method takes an argument to activateWorkflow . If set to True , it publishes both approved and unapproved items; but when it is set to False , it is added to the queue, and we get a success message, but nothing is published.

Does anyone have any ideas how I can fix this using the publish method and without manually checking?

Thanks.

+4
source share
2 answers

It is not clear where you are doing the actions, are you doing this from your actions in Visio?

The publication will always publish only those elements that are in the approved status for this purpose, and elements that have completed the workflow (major versions).

All that said, I believe that you are becoming empty. PublishTransacctions is that you call the Publish () method on new elements before you finish the workflow on the page (this means that your new element is still in the workflow, so false means that there is nothing to publish, that not works in the workflow). Try calling FinishActivity () before calling Publish ().

Perhaps you could post your code from the last step so that we can see exactly what you are doing.

+2
source

I had a similar problem while viewing Component Workflow and publishing static pages (without dynamic component presentations).

When publishing for testing, as you mentioned, just activate the function Workflow = true. For your live environment, you need to start publishing after the workflow is complete. To do this, I solved the problem through the event system. Here's an article that discusses this in more detail, which may help you:

http://www.tridiondeveloper.com/autopublishing-on-workflow-finish

+5
source

Source: https://habr.com/ru/post/1442177/


All Articles