Each time a pre-event handler is called, the Changing
event handler is also called. Similarly, each time a post-event handler is called, the Changed
event handler is called. The Changing
and Changed
event handlers are known as generic event handlers because they are fired for every operation that is performed on a posting.
In the examples above, we have been writing code in specific event handlers (e.g. Submitted
, Approved
). When customizing the workflow, you can write code in the Changing
and Changed
event handlers as an alternative. The code below shows how this can be done in the Changed
event handler. Bear in mind, however, that it is considered bad practice to do so. Generic event handlers are called each time an event is raised so placing code there incurs more overhead than putting it in specific event handlers.
public void CmsPosting_Changed( Object sender, ChangedEventArgs e ) { switch(e.Action) { case PublishingAction.Approve: // after...