Add a Fire Data Provider Event Action

You add a Fire Data Provider Event action to dispatch an event on a data provider in order to reflect changes to your data. For example, a component using a particular Service Data Provider (SDP) may need to display new data because new data has been added to the endpoint used by the SDP.

The action can be called either with a mutation or a refresh event. The refresh event re-fetches and re-renders all data, and the mutation event is used to specify which changes to show.

Note:

This action is not necessary for a VB Array Data Provider (ADP) variable, since the data array of an ADP variable, exposed via the data property, can be updated directly using the Assign Variable action. Assigning the data array is automatically detected by VB Studio, and all listeners are notified of this change. Users will be warned of this when the fireDataProviderEvent is used with an ADP, prior to mutating the data property directly.

For API information about this action, including further details about its properties, see Fire Data Provider Event Action in the Oracle Visual Builder Page Model Reference.

To use a Fire Data Provider Event action:

  1. Add the action in one of three ways, as explained at the end of Built-In Actions.

  2. Update the ID field in the Properties pane to make the action more identifiable.
  3. For Event Target, set the target of the event by hovering over the far-right side of the property and clicking Select Variable to choose the relevant ServiceDataProvider or ArrayDataProvider.
  4. Select the type of event you want to dispatch:
    • Refresh: Used to show all changes.
    • Mutate: Used to specify which changes to show.

      A mutation event can include multiple mutation operations (add, update, remove) as long as the ID values between operations do not intersect. This behavior is enforced by JET components. For example, you cannot add a record and remove it in the same event, because the order of operations cannot be guaranteed.

  5. If you chose the Mutate event, ensure that the keyAttributes property is set for the SDP variable. The parameters for showing the added, removed and updated records are under the add, remove and update sections. Here's what's required for each section, for the mutate event to perform optimally:
    1. add section: Use the data parameter to pass the added record or records from the add operation’s returned result. If you are using an SDP variable, the structure of the data must match the structure specified by the itemsPath parameter of the SDP variable’s definition:

      Use the keys parameter to pass the key values of the added records with the Set<*> format. Lastly, use the metadata parameter to pass the key values of the added records with the format Array.<ItemMetadata.<KeyValue>>.
      Example:
      data: {items: [callRestCreateEmployeeResult.body],},
      keys: [callRestCreateEmployeeResult.body.id],
      metadata: [{key: callRestCreateEmployeeResult.body.id,}],
    1. remove section: Use the keys parameter to pass the key values of the deleted records with the Set<*> format
    1. update section: Same as the add section.