Yes this is possible by subscribing to the lifecycle events of the content modules. The approach is to create a custom decorator as described in this
KB article. The approach is to have a separate decorator for each module you want to handle lifecycle events like publish, modify (delete is a separate topic). The decorator attaches to an event, for example publish.
When we talk about a custom decorator that will handle dynamic content (module builder) you have to change the registration of the decorator in Global.asax. This is necessary because in Dynamic modules the items you create are not inheriting from content and while all other modules (news, blogs, events), register a decorator that will handle content
Dynamic modules register the decorator like this:
sender, EventArgs e)
sender, Telerik.Sitefinity.Data.ExecutedEventArgs e)
For the module builder each item you create regardless of the naming of your module it is considered DynamicContent so in the decorator register the item you will be working with like this
DynamicContent newsItem = masterItem
// add logic that will be executed when item is publsihed
.ExecuteOnPublish(masterItem, liveItem, culture, publicationDate);
I realize you will need to work with a lot of different modules with the module builder and creating new decorator for each separate module will not be possible so specify the type of module you will be executing something on publish like this.
DynamicContent dynamicContent = item
dynamicContentType = dynamicContent.GetType().FullName;
// execute logic for one module called TestingModule
.. add another module logic below
Execute your update of the field on publish as the functionality of the decorator.
In development now are events for the Module builder that will alow you to execute additional actions on all events of module builder items to address more cleaner way of handling this task.
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking
system and vote to affect the priority of the items