DocumentEvents not triggering when Page URL slug is updated

Jason Lindsay asked on February 13, 2023 23:34

I have created a module that I want to trigger whenever a user updates the page's URL slug. However I am unable to get my custom module code to fire. I have tried a number of alternatives, namely:

DocumentEvents.Insert.After
DocumentEvents.Update.Before
ObjectEvents.Update.Before
PageUrlPathInfo.TYPEINFO.Events.Update.Before
PageUrlPathInfo.TYPEINFO.Events.Insert.Before
PageFormerUrlPathInfo.TYPEINFO.Events.Update.Before

None of these events fire when updating the URL slug, and I am not finding a PageUrlEvents category or anything similar. Has someone else solved for a situation like this?

Recent Answers


Juraj Ondrus answered on February 14, 2023 12:12

Regrettably, there isn't any specific event which is triggered in such case - the reason is that routes are updated via a procedure when slug is created/updated - so we can handle it in bulk when we need to update routes for the whole (sub-)tree. It would be maybe possible to use another event, e.g.:

  • staging task LogChange event: however it depends what exactly you want to handle in the code

  • maybe also ExecuteQuery event could be used which should be triggered as well

0 votesVote for this answer Mark as a Correct answer

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