Design an Asynchronous Search Operation with Pagination

This use case is similar to designing an integration with asynchronous Basic (CRUD) operations. The only difference is that the results returned are paginated. This use case uses an Oracle NetSuite Adapter invoke connection configured to make an asynchronous search operation call.

A high-level overview of the configuration steps is provided below.

  1. Create a scheduled or orchestrated integration. For this example, a scheduled integration is created.
  2. Add an assign action (for this example, named InitializeVariables) and initialize the following variables.
    • pageIndex - string data type - value of -1
    • totalPages - string data type - value of -1
    • jobId - string data type - value of -1
  3. Add a while action and specify the following condition.
    integer($pageIndex) <= integer($totalPages)
  4. Inside the while action, add an Oracle NetSuite Adapter as an invoke connection to make asynchronous calls. This invokes the Adapter Endpoint Configuration Wizard.
  5. On the Operations page, select Asynchronous as the processing mode, Search as the operation type, and Search on selected Business Object as the search type.

    The Operations page shows the Cancel and Done buttons in the upper right. The wizard train shows the Basic Info, Operation, Search Configuration, and Summary. Previous and Next buttons appear before and after the train. Below the train is the Operations section, which includes the Select Processing Mode label, with selections for Synchronous and Asynchronous (which is selected). Below this is the Select an Operation Type section, with Search as the selected option. Below this is the Select a Search Type label. There are four selections. Search on selected Business Object is selected.

  6. Select the business object (for this example, Account is selected).

    The Select Business Object section shows that the Account business object is selected.

  7. In the mapper positioned in front of the Oracle NetSuite Adapter invoke connection, map the jobId and pageIndex variables created in step 2 to the jobId and pageIndex variables defined in the Oracle NetSuite Adapter request schema under the Async Job Parameters element.

    This image shows the mapper. Below this is the Source element tree. To the right of the Source element tree is the Mapping canvas column. To the right of this is the Target element tree. The Source element tree includes the jobId element and pageIndex element, which have been mapped to the JobId element PageIndex element, respectively,in the Target tree.

  8. Map additional elements as required for your business use case.
  9. Add a second assign action after the Oracle NetSuite Adapter (for this example, named ReAssignVariables) and assign the jobId created in step 2 with a value from the response of the Oracle NetSuite Adapter invoke connection.
  10. Add a switch action with the condition to check if the status of the submitted job is finished.

    The Input sources tab (which is selected) and the Functions tab are shown. Below is the Sources tree, which is expanded to show the status element. This element has been mapped to show status = 'finished' as the routing.

    For the above condition, this results in two routes being created:

    • status is finished: For this route, create an assign action (for this example, named IncrementPageIndex) that increments the pageIndex variable and assigns the totalPages variable with the actual value from the results of the asynchronous job performed in the Oracle NetSuite Adapter invoke connection. The two assignments needed in this assign action are as follows.
      For the pageIndex variable assignment, the Expression Summary is:
      pageIndex + 1.0
      For the totalPages variable assignment, the Expression Summary is:
      totalPages
    • status is anything other than finished: This means that the asynchronous job is either still running, finishedWithErrors, or failed. Add another switch action in this route to deal with jobs that are finishedWithErrors or failed. The otherwise condition for the new switch action means that the job is still running. In which case, the control loops back to the while loop created in step 3.
    When the integration is complete, the Oracle NetSuite Adapter enables you to make use of its extensive search capabilities in asynchronous mode with full support for retrieving the paginated result set.