I'm trying to set a date-field of a new Component automatically when created, using the event system.
The approach is to set the field in the GetInstanceDataEvent
public Events()
{
EventSystem.Subscribe<Component, GetInstanceDataEventArgs>(HandlerforComponentGetInstance, EventPhases.TransactionCommitted);
}
And the function to update the field:
private void HandlerforComponentGetInstance(Component comp, GetInstanceDataEventArgs compGetIniEventArgs, EventPhases eventPhases)
{
throw new Exception("-------THE EVENT IS TRIGGERED------------");
}
But the trace is never logged. I've tryed changing the eventphase to "initiated" but the result is the same. I restarted COM+ and the required services, and I've working other events perfectly, but this is never triggered when I create a new Component and select the Schema.
What is the correct use for this event?