2

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?

4

The GetInstanceData action/event is triggered on a Schema, not on a Component.

  • Right, using Schema despite Component does the job. – Julián Hernández Aug 9 '17 at 6:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.