Create Custom Event Method

The following steps outline the process of creating the Custom Event Methods:

  1. From the Table of Contents, expand Administration and select Methods. The Methods Table of Contents appears.

  2. Click Create New Method.

    The Method form appears.

  3. Add the Method Name and the following properties:

    • Method Location: Server-Side
    • Method Type: C#
    • Execution Allowed To: ehf_EventPublishers
  4. Write the method code to 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;

  5. Click Done to save.