Design a Basic Asynchronous CRUD Operation

This use case provides an overview of how to design an integration in which an Oracle NetSuite Adapter invoke connection is configured with an asynchronous Get operation. The design logic is similar for the other CRUD operations (Add, Delete, Update). Once configured, this integration automatically either submits a new asynchronous job or checks the job status and gets the results based on certain variables being mapped properly.

A high-level overview of the configuration steps is provided below.
  1. Create an application or schedule integration. For this example, an application integration is created.
  2. Add an adapter as a trigger connection. For this example, the REST Adapter is added and configured.
  3. Add an assign action (for this example, named InitializeVariables) and initialize the following variables.
    • jobId - string data type - value of -1
    • jobStatus - string data type - value of -1
  4. Add a while action and specify the following condition.
    $jobStatus != "finished" and $jobStatus != "finishedWithErrors" and $jobStatus != "failed"
  5. Inside the while action, add an Oracle NetSuite Adapter as an invoke connection to make asynchronous calls. This invokes the Adapter Endpoint Configuration Wizard.
    1. On the Operations page, select Asynchronous as the processing mode, Basic as the operation type, and GET as the CRUD value.
    2. Complete the Adapter Endpoint Configuration Wizard.
  6. In the mapper positioned in front of the Oracle NetSuite Adapter invoke connection, map the jobId variable created in step 3 to the jobId variable defined in the Oracle NetSuite Adapter request schema under the AsyncJobParameters element.
  7. Map additional elements as required for your business use case.
  8. Add a second assign action after the Oracle NetSuite Adapter (for this example, named ReAssignVariables) and assign the jobId and jobStatus variables created in step 3 with values from the response of the Oracle NetSuite Adapter invoke connection.
  9. Add a switch action and edit the first branch. The loop ends once the following condition is satisfied.

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

    1. jobStatus is either finished, finishedWithErrors, or failed. You can now get the results from the Oracle NetSuite Adapter invoke connection response and, based on your business needs, can process the results. For example, for an Add Customer asynchronous job, if the job finished successfully without errors, you can get the internalIds of the created Customer records.
    2. jobStatus is neither of the above values. This means that the asynchronous job is still running. Before you can get the job results, either perform other operations or wait and loop back to the while loop created in step 5.

      The completed integration looks as follows. The Oracle NetSuite Adapter automatically either submits a new asynchronous job or checks the job status and gets the results based on the jobId passed in the request.