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.
  6. Select the business object (for this example, Account 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 AsyncJobParameters element.

  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.


    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:
      Description of asynchr_pageindex.png follows
      Description of the illustration asynchr_pageindex.png

      For the totalPages variable assignment:
      Description of asynchr_totalpages.png follows
      Description of the illustration asynchr_totalpages.png

    • 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.
    The completed integration looks as follows. The Oracle NetSuite Adapter now enables you to make use of its extensive search capabilities in asynchronous mode with full support for retrieving the paginated result set.