Custom Event Type
A Custom Event Type allows administrators to use method code to add events to the publishing queue. This capability enables publishing for events that fall outside the scope of the Event Handling Framework’s standard Item Event Types.
Create Custom Event Type
The following steps outline the process of creating a Custom Event Type:
- On the Subscription form, click Edit.
From the Subscription form, scroll down to the Event Types tab and click New Event Type.
The Select Item Type dialog box appears.
Select Custom Event Type and click OK.
A new row appears on EventTypes tab.
Right-click on the newly added row and click Open.
The Custom Event Type form appears.
- Add the Event Name and Description.
The Event Name is required to map the event in the publishing queue to the type of event. Click Done to save.
The Handled By tab shows all the Event Handlers that process this Custom Event Type grouped by Subscriptions. Make sure to save the Subscription otherwise the Subscription will not be visible.
The Administrators need to develop the method to generate the Server Events that triggers to add events in the publishing queue.
NoteThe Execution allowed to field should be set to ehf_EventPublishers when creating a Server Events method.
Create Custom Event Method
The following steps outline the process of creating the Custom Event Methods:
From the Table of Contents, expand Administration and select Methods. The Methods Table of content appears.
Click Create New Method.
The Method form appears.
Add the Method Name and the following properties:
- Method Location: Server-Side
- Method Type: C#
- Execution Allowed To: ehf_EventPublishers
Write the method code that will add a custom event to the publishing queue.
The following sample code demonstrates how to use the ehf_PublishEvent action to add a Custom Event to the queue. Replace the highlighted text with the data that will be processed by an Event Handler Method (see section “Create Event Handler Method”):
Item publishEvent = this.newItem(“Method”, “ehf_PublishEvent”);Item eventItem = this.newItem();eventItem.setProperty(“type”, “Custom Event Type Name”);eventItem.setProperty(“subject”, “context item id or subject string”);eventItem.setProperty(“data”, “context item data”);publishEvent.setPropertyItem(“event”, eventItem);Item result = publishEvent.apply();return this;- Click Done to save.
Configure Custom Event Method Execution
To publish a Custom Event, the Custom Event Method created in section “Create Custom Event Method” must be executed as an ItemType Server Event, an Action, or some other process.
The following steps outline the process of adding the Custom Event Method as a Server Event on an ItemType:
From the Table of Contents, expand Administration and select ItemTypes. The ItemTypes Table of Contents appears.
Click Search ItemTypes.
The ItemTypes grid appears.
In the Name field, enter the required ItemType whose data should be published and click Search.
Right click the ItemType in the grid and click Open.
- Click Edit.
Click the Server Events tab.
Click Add Methods.
In the Select Items dialog box, search for the method created in the Create Custom Events Method section and click OK.
In the newly created Server Event row, choose the Event that should trigger the execution of the Method.
Click Done to save.
For more information on configuring Server Methods, please see the Developing Solutions Training Guide or the Aras Innovator Programmer’s Guide.
Configure Event Publisher Identity
The ehf_EventPublishers Identity is a group Identity used to grant permissions for adding event
to the publishing queue. Any users who may cause an event to be added to the publishing queue
should be added to this Identity.
The following steps outline the process of adding one or more Users (or group Identities) to the
ehf_EventPublishers Identity:
From the Table of Contents, expand Administration and select Identities. The Identities Table of Contents appear:
Click Search Identities.
The Identities Search grid appears.
- In the Name field, enter ehf_EventPublishers and click Search.
Right-click on the ehf_EventPublishers and click Open.
- Click Edit.
In the Member tab, click Add Identities.
In the Select Items dialog box, select one or more Identities to include in the event publishing group and click OK.
- Click Done to save.