Can't find event for when a page gets published with "publish from"

Mirko Milanovic asked on August 25, 2021 16:11

I am using scheduled publishing for pages and I need an event that is triggered when the page actually gets published (when it reaches its "publish from" date and time). Does such event exist or is there another way to execute custom code when a page reaches its "publish from" date and time?

Recent Answers


David te Kloese answered on August 25, 2021 16:58

I'm not sure there is an actual event fired, as it's done by an separate scheduled task.

"If you set the Publish from/Publish to values to pages that use workflow, they still need to be approved before being published. Once approved, the page is published by a scheduled system process. The process is set to execute every minute by default. The process only publishes the page if the page already reached its Publish from time. You can check the status of this process in the Scheduled tasks application. Choose the website and search for the Content publishing task."

What would need to happen by your custom code?

You could create you own Scheduled task that would completely take over the publishing OR that would just check every minute if there is any page that got published from set in the current minute and is actually published.

1 votesVote for this answer Mark as a Correct answer

Zach Perry answered on August 25, 2021 17:56

You can try the publish event on the workflow event. Pretty sure that fires when the document gets marked published from the publish from/publish to dates. I think there are scenarios where it can trigger multiple times, so might want to double check that.

0 votesVote for this answer Mark as a Correct answer

Dmitry Bastron answered on August 26, 2021 06:54

Hi guys,

Zach is correct, try out using publish event from the workflow events category. There are also a couple of other things to keep in mind working with publishing and workflow:

  • cache invalidation and workflow can be tricky sometimes, I've got a small blog post regarding this issue
  • when you are using publish from field without workflow, publish event will never fire, so you won't be able to hook into this event
1 votesVote for this answer Mark as a Correct answer

Mirko Milanovic answered on August 30, 2021 12:01

My code needs to write to a file for example, it's just a POC. I've created a custom Scheduled task, but I can't figure out how would I check all "publish from" values of every page of a specific page type and whether they are published or not, from the Execute method?

I've also tried with the workflow publish event, but it doesn't fire even when I use a workflow, so David's solution seems to be the only one.

0 votesVote for this answer Mark as a Correct answer

Dmitry Bastron answered on August 30, 2021 12:13

Hi Mirko,

Could you explain what are you trying to POC top-level? There may be other ways of doing similar thing.

Are you looking at synchronizing page details to some third-party service once the page is published or something similar?

0 votesVote for this answer Mark as a Correct answer

Mirko Milanovic answered on August 30, 2021 12:54 (last edited on August 30, 2021 14:57)

Hi Dmitry,

I need to do exactly that. Is there any way to do it?

0 votesVote for this answer Mark as a Correct answer

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