Customize Workflow.Publish event

toru sato asked on February 24, 2019 20:58

Hi

I want to reflect the page contents in other languages ​​on the same page when I publish on the workflow applied page. We added processing by hooking workflow.publish event in GlobalEvent. So we were able to deploy pages to another language using DocumentHelper.InsertNewCultureVersion.

However, when publishFrom of the page is set to the future date or PublishTo is made the past date, the workflow.publish event does not occur. The workflow.Approved event was hooked so we incorporated the same workflow.Approved event. Then the specification of the TreeNode instance for specifying the copy source page and the copy destination page returns NULL. Does anyone know this cause? In the TreeNode instance, nodes are acquired in the following way.

TreeNode page = tree.SelectNodes () .Path (e.Document.NodeAliasPath) .OnSite ("sitename") .Culture ("en-us") . FirstObject;

TreeNode publishPage = DocumentHelper.GetDocuments () .WhereEquals ("NodeAliasPath", e.Document.NodeAliasPath) .OnSite ("sitename") .Culture ("en-us") .FirstObject;

Recent Answers


David te Kloese answered on February 25, 2019 14:29

Hi,

wouldn't the "combine with default culture" setting do what you need without creating a copy into a different culture?

Image Text

If you need it, or have different logic you could also check the "SaveVersion" event and just check the PublishFrom value. (docs.kentico.com/.../#Reference-Globalsystemevents-WorkflowEvents)

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.