Scheduled publishing with advanced workflows

Mirko Milanovic asked on September 28, 2021 13:14

I need to send data to an external API when a certain page type is published or archived. I am using an advanced workflow and I have created a custom action step for sending data and I've put it in front of the Published and Archived steps. It all works well for regular publishing, but I am having a problem with scheduled publishing (with "publish from" and "publish to") because the page has to be pushed to the Published step in order for the Scheduler to start checking if the "publish from" date and time is reached and so my action step occurs at that time instead of when the page is actually published (when it reaches its "publish from" date and time). Another problem is that when the page reaches its "publish to" date and time, it doesn't get pushed into Archived step automatically, so my action step isn't executed at all and the page remains in the Published step, even though it is actually archived. Is there any way to get this functionality with advanced workflow?

Recent Answers


Dmitry Bastron answered on September 28, 2021 14:58

Hi Mirko,

Unfortunately, Publish From and Publish To fields are really tricky to marry with the events. Technically, when you set up Publish From field in Kentico there is a system scheduled task called Content publishing which runs every X minutes to check if there is anything to publish at all. However, when this task changes the state of the page, it doesn't fire any event you can hook into and the page silently appears or disappears, i.e. none of these events is fired.

As a workaround, you can build your own scheduled task which will be checking every X minutes were there any new pages published or unpublished, and if any - do your custom logic sending to the API. Unfortunately, with the workflow it wouldn't work I think.

1 votesVote for this answer Mark as a Correct answer

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