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 Visual Builder, 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.

To use a Fire Data Provider Event action:

  1. Add the action in one of three ways, depending on your preference and where you want it added:
    • Drag the action from the Actions palette onto the canvas, dropping the action either at the bottom edge of the action it is to follow, or at the top edge of the action it is to precede.
    • Double-click the action in the Actions palette to add it to an empty canvas or to the end of an action chain.
    • On the canvas, select the action you want the new action to follow, then double-click the new action in the Actions palette.


  2. Update the ID field in the Properties pane to make the action more identifiable.
  3. Set the target of the event by hovering over the far-right side of the Event Target property and clicking the down arrow that appears to choose it. Usually, this is a variable of type 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.
For further details about this action's properties, see Fire Data Provider Event Action in the Oracle Visual Builder Page Model Reference.