Custom Module event handlers
I have created a custom module (using module builder). Can you please explain to me how I can capture the events that are fired during item creation (or for that matter item deletion/update as well)? For example, I have a custom module is called 'Projects'. It's content type is of type 'Project'. In the admin interface, I would like to intercept the 'Create a Project' event in order to add code that will send email notifications to a group of people. Surely this must be possible. Looking at the 'code reference' for this module, there are no real examples of performing this task...
This seems to be a good case for 'Workflow' where you can add any custom code/business process-- but there doesn't seem to be any custom types of workflow that you can attach (they're all pre-configured for approval processes...)
Great! thanks for the response. Do you happen to have any code samples on how to implement these methods? I've used the following as a baseline example and have it all working as this example, but am a bit unsure as to how to override the actual methods I'm interested in (capturing the create/edit events as opposed to the 'published' event)...
I'm just posting to follow up to my own post as I resolved my own issue. By following the example of the previous KB article I simply had to do the following (which appears to work). In the 'ExecuteOnPublish' method, simply subscribe to the events you're interested in there -- and then create the handler methods to do the custom tasks (after contentCreation/contentUpdate).
protected override ILifecycleDataItemGeneric ExecuteOnPublish(ILifecycleDataItemGeneric masterItem, ILifecycleDataItemGeneric liveItem, System.Globalization.CultureInfo culture = null, DateTime? publicationDate = null)
ILifecycleDataItemGeneric i = base.ExecuteOnPublish(masterItem, liveItem, culture, publicationDate);
EventHub.Subscribe<IDynamicContentCreatedEvent>(evt => ContentCreatedEventHandler(evt));
EventHub.Subscribe<IDynamicContentUpdatedEvent>(evt => ContentUpdatedEventHandler(evt));
Thanks for pointing me to the proper methods Steve (I just needed a bit more understanding on where exactly to subscribe to these events)...