Invoke Custom Actions via Upload

For services that support custom actions that correspond to the item path, the user can mark rows so that the custom action is called on those rows during the upload. For custom actions that require payload fields, table columns that correspond to those fields must be added. See Custom Actions.

During the upload operation (which may also include update, create, and delete tasks), the add-in performs the following steps for each row marked for action:

  1. Creates the payload by collecting the cell values for each custom action field column and adding the value to a simple JSON object (member name/value pairs) in the payload. If configured, empty values are skipped. See Omit Empty Values During Upload.

    The entire payload body follows this example format:

    {
      "rejectionReasonCode": "Other: contact approver",
      "notes": "Details with manager"
    }
    • There is no other content in the POST request body (no action name, no array of argument values).
    • If any values from these columns are invalid (missing when required, incorrect data type, Excel formula error), the row is omitted from the Upload and marked as failed. See Data validation in Managing Data Using Oracle Visual Builder Add-in for Excel
  2. Prepares the request:
    • REST-Framework-Version header added (see Configure the REST-Framework-Version)
    • Content-Type header added based on each custom action's Request Media Type property on the Custom Action Editor (available from the Business Object Editor > Custom Actions tab)
  3. Makes the request:
    • Sends the POST to the custom action path (POST is the only HTTP method supported for invoking custom actions)
  4. Processes the response:
    • For 200 response status, the row is marked as succeeded.
    • For 400 response status, the row is marked as failed and the response payload is parsed for Oracle ADF REST Resource service error content. Error details can be seen in the Status Viewer pane.
    • A 412 response status indicates that the row was modified by some other agent or user after it was downloaded to the Excel table; such a status is treated as a row-level error

    Cell values in action rows are not refreshed. If the custom method logic in the service has altered any values in the row, those changes will not be reflected in the table row until the next download.

    If the response payload for the Custom Action request includes a "result" member, the add-in parses it as follows and displays the result in the Status Viewer:

    • Simple scalar values are displayed verbatim
    • The first level of JSON objects and arrays are unpacked
    • Deeper levels of JSON are displayed verbatim

    Note:

    Row status custom actions have their own expected "result" schema. See Row Status Custom Action Response Schema.

    For example, after invoking the custom action "Reject" on an Expense Report table row, the REST service may return a result such as "result": "Your confirmation code is 26281.". This result is displayed in the Status Viewer, as shown here:
    The Status Viewer showing the result from a custom action

    See Executing a Custom Action in the Developing Fusion Web Applications with Oracle Application Development Framework.

For more information on custom actions, see Custom Actions.