Registering New Event Types

Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

When your custom event type class is implemented, you must register it with the Alerts framework. The Alerts framework enables the Alerts functionality, which is a notification system that helps users track critical events in Microsoft Dynamics AX. To register your custom event type class, you need to list it in the EventType::eventTypeClassIdsHook static method of EventType class. The method is formatted as follows.

protected static container eventTypeClassIdsHook()
{
    return [classNum(myEventTypeClass1), classNum(myEventTypeClass2), ... ];
}

Register a New Event Type

If you implement only the EventTypeCUDIncreasedAtLeastBy event type class, the method is formatted as follows.

protected static container eventTypeClassIdsHook()
{
    return [classNum(EventTypeCUDIncreasedAtLeastBy)]; 
}

When you have done this, your custom event type will appear in the list of events offered for numerical fields in the EventCreateRule form. The following figure shows the EventCreateRule form with the option has increased above: appearing for selection in the Event field.

EventCreateRule form with a custom event type

The EventCreateRule form with a custom event type

The option has increased above:, which now appears in the list, is the label returned by the Description method of your custom event type class.

After you select the has increased above: event, enter the appropriate value in the text box next to the Event field. The following figure shows the EventCreateRule form with a value that qualifies the has increased above: option.

EventCreateRule form: value to qualify event type

The EventCreateRule form with a custom event type and a value that qualifies the event type

For many forms, when you right-click on the form, you see the option to Create alert rule.... Clicking the option starts the Create alert rule form.

See also

Create alert rule (form)

Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.