I'm attempting to register a custom event handler to SDL Web 8.5.
[TcmExtension("ResponsiveTableEvents")]
public class ConditionalEvents : TcmExtension
{
private const string SchemaRootElementName = "table";
public ConditionalEvents()
{
Subscribe();
}
public void Subscribe()
{
EventSystem.Subscribe<IdentifiableObject, SaveEventArgs>(SaveItem, EventPhases.Initiated);
}
private void SaveItem(IdentifiableObject item, SaveEventArgs args, EventPhases phases)
{
var component = item as Component;
if (component == null) return;
if (component.Schema.RootElementName == SchemaRootElementName)
{
TableComponent.Process(component);
}
}
}
I followed the official documentation here. Once completed, I stopped the IIS and SDL Web Content Manager Service Host services. I dropped the compiled DLL in %TRIDION_HOME%/bin/
. I updated the Tridion.ContentManager.config
to include:
<extensions>
<add assemblyFileName="C:\Program Files (x86)\SDL Web\bin\My.Custom.EventHandlers.dll" />
</extensions>
I restarted the services. I verified that the event handler has been loaded by checking Event Viewer/Applications and Services Logs/Tridion.
The customer event handler logic is to throw an exception if validation is not met - for example, depending on the type selected in one field, it requires a specific field to be mandatory.
I created a Table component and saved the changes knowing that the custom event handler should throw an error but it doesn't. The code to throw an error is:
throw new Exception("Test Error Message!");
What I've tried:
- Restarted all SDL services
- Restarted COM+ System Application service
- Checked Event Viewer, no error
- Check cd_core logs, no error
- Commented out my logic, and simply throw an exception on the custom event handler method "SaveItem" and re-deployed but still nothing.
Are there anything else that I could to do to troubleshoot or have I misunderstood an instruction from the documentation?