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?

1 Answer 1

4

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

1
  • Right, using Schema despite Component does the job. Commented Aug 9, 2017 at 6:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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