Configuring polled events to trigger flows

IBM® App Connect has some pre-configured events that you can select as triggers for your flows. For some applications, you can configure more events that can trigger a flow by polling an application for new or updated objects. This tutorial shows you how to configure those polled events.

How it works

To create a polled event that triggers a flow, you configure App Connect so that it knows when something has changed in your application. This requires the application to add a timestamp when an object is created, and an additional timestamp each time that object is updated. This is common practice for most applications. App Connect polls the application at regular intervals that you specify, and if an update has a timestamp after the time when your flow was started, the flow is triggered and the actions in your flow are completed. To do this, App Connect requires the application to filter by timestamp, so that it retrieves all objects since a particular time.

You can see which applications have configurable polled events on the Applications tab on the Catalog page. When you expand an application, if you can configure events for it, you'll see Show more configurable events under the list of pre-configured events. Click the link and expand an object to see which events you can configure.

Configuring a polled event

To create a new event-driven flow to be triggered by a polled event, complete the following steps:

  1. Click Create > Event-driven flow, expand an appropriate source application (for example, Salesforce), and then click Configure more events....
  2. Expand the object that you want to monitor and select the type of event.
    For example, we might want to trigger your flow every time a new order is created in Salesforce, so you'd choose the New order event.
    Figure 1. Screenshot showing selection of New order event in Salesforce
    Screenshot showing selection of New order event in Salesforce
  3. If prompted, provide any required information about the object that will trigger your flow.
  4. Configure the fields to detect the event by polling:
    • Created timestamp field: Select the field from your application that contains the timestamp for when the object was created.

      The list of fields that are shown for both timestamps are the ones that are provided by the application for use in filters.

    • Last updated timestamp field: Select the field from your application that contains the timestamp for when the object was updated.
    • Format of the timestamps: Enter a format for the timestamp by using letters. In most cases, the field will already contain the correct formatting for the timestamp of the selected application.

      For some applications, timestamps might not be in a standard format that App Connect can recognize. So you need to convert the actual timestamp that's produced by the application to a letter-based format that App Connect can interpret; for example, for a timestamp of 2017-10-04T10:58:33+05:30, set the field to YYYY-MM-DDTHH:mm::ssZ.

    • Timezone: Select the time zone that applies to the timestamps. The default time zone is UTC (Coordinated Universal Time), so you only need to select a time zone if it's not UTC.

      It's important to ensure that App Connect knows what time zone the timestamps relate to so that it can detect updates that happen after the flow is started. For many systems, timestamps are returned in Coordinated Universal Time (UTC), which is the default time zone for App Connect. Some applications have a system-wide setting that causes all timestamps to be returned in a particular time zone. In other applications, the time zone is configured on a per-user basis.

    • Check for event every (minutes): Select the frequency with which App Connect polls the application for changes to the object.

      App Connect will check the application at the specified interval, and if it detects an update with a timestamp that's after the time when the flow started, it will trigger the flow to complete its actions. If you specify a short interval, App Connect will detect events more quickly, but it will use more API calls.

    • Is created timestamp queryable?: Select this checkbox for new object events if the created timestamp field is queryable.

    The valid selections for Created timestamp field, Last updated timestamp field, and Is created timestamp queryable? by event type are as follows.

    Event type Valid selections

    New object

    Either of these selections is supported:

    • Select a value from Created timestamp field and select Is created timestamp queryable. (Skip Last updated timestamp field.)

      Interpretation: Use only the created timestamp to poll for new objects that were created within the specified time window.

    • Select a value from both Created timestamp field and Last updated timestamp field, and ensure Is created timestamp queryable is clear.

      Interpretation: Use both the created and last updated timestamps to poll for new objects that were created within the specified time window. Events are identified as new only if the created and last updated timestamps match.

    Updated object

    Select a value from both Created timestamp field and Last updated timestamp field.

    (Is created timestamp queryable isn't displayed.)

    Interpretation: Use both the created and last updated timestamps to poll for objects that were updated within the specified time window. Events are identified as updated if the created and last updated timestamps are different.

    New or updated object

    Select a value from Last updated timestamp field and skip Created timestamp field.

    (Is created timestamp queryable isn't displayed.)

    Interpretation: Use the last updated timestamp to poll for objects that were either created or updated within the specified time window.

    Figure 2. Screenshot showing how to configure the Salesforce New order event
    Screenshot showing how to configure the Salesforce New order event
  5. Complete your flow in the usual way by adding whatever actions and logic you need.
  6. Click Start flow on the toolbar, then click Dashboard to exit the flow.
  7. Test your flow by creating or updating the configured object in your application and ensuring that any actions are completed.