Use Bulk Response Operations in an Integration

This use case provides an overview of how to retrieve the response for a job created by a bulk operation (create, update, upsert, and delete).

This use case uses the following bulk operations.
  • Get Status For All Batches: Requests the details of the bulk job primarily for checking job status. Once the job completes, you can fetch the batch results using the Get Batch Results operation. It takes the jobId as input and provides details/status of all batches for the job ID provided.

  • Get Batch Results: Requests the response data for the batches of its respective job. It takes the jobId and BatchId as inputs and downloads a file. The file contains the respective batch response data to Oracle Integration, the response file path, and the file name. This information is available to you in the response mappings.

The functional overview of the integration is as follows:


Description of sf_bulk_summary.png follows
Description of the illustration sf_bulk_summary.png

Create an Orchestrated Integration and Perform the Initial Connection Configuration and Mapping

Note:

This use case assumes you have already configured a SOAP Adapter, Oracle Integration, and FTP Adapter on the Connections page.
  1. On the Integrations page, click Create.

  2. Select the Orchestration pattern, click Select, then select Application Event or business object as the option to trigger this integration.

  3. Drag the SOAP Adapter to the trigger section of the integration canvas.

  4. Complete the Adapter Endpoint Configuration Wizard pages for the SOAP Adapter by selecting appropriate operation and header values.

  5. Drag the Oracle Integration below the SOAP Adapter in the integration canvas.

  6. Complete the Adapter Endpoint Configuration Wizard pages for the Oracle Integration by specifying the following:
    • Name the connection (for this example, named SFDC_GetAllBatchStatus).

    • Select the Perform Bulk Data Operations operation type.

    • Select the Get Status For All Batches operation.

  7. Open the mapper and map the source SOAP request input element to the target Salesforce getAllBatchStatus input payload. For example, map the input1 element to the jobId element.

Create a For Each Action in the Integration

  1. Drag a For Each action immediately below the SFDC_GetAllBatchStatus Oracle Integration.

  2. Name the action, then drag batchInfo (the response of getallbatches) to the Repeating Element field.

  3. In the Current Element Name field, enter a name (for this example, TempBatch), then click Done.

  4. Drag a second Oracle Integration connection to the workspace inside the For Each action.

  5. Complete the Adapter Endpoint Configuration Wizard pages for the Oracle Integration by specifying the following:
    • Naming the connection (for this example, SFDC_GetBatchResults).

    • Specifying the Perform Bulk Data Operations operation type.

    • Specifying the Get Batch Results operation.

  6. In the response mapper for getBatchResults, map the source id element under TempBatch to the target batchId and the source jobId element under Tempbatch to the target jobId.

  7. Validate the mappings, then close the mapper and save your changes when prompted.

Add a Stage File Action to the For Each Action

  1. Drag a Stage File action inside the For Each action and below the SFDC_GetBatchResults Oracle Integration. The stage file action can read (and remove any trailer), write, zip, unzip, and list files in a staged location known to Oracle Integration.

    The Configure Stage File Action wizard is displayed.

  2. Provide a name, then click Next.

  3. On the Configure Operation page, select Read Entire File from the Choose Stage File Option list, then click the Select Expression icon to specify the file name.

  4. Drag the source fileName element to the Expression field, then click the Expression Summary Refresh icon to display the name. This action provides a file name to receive in the SFDC_GetBatchResults response.

  5. Click Save, then Exit Expression Builder.

  6. Click the Select Expression icon to specify the directory from which to read the file.

  7. Drag the source dirPath element to the Expression field, then click the Expression Summary Refresh icon to display the name.

  8. Click Save, then Exit Expression Builder.

  9. Review your selections, and click Next.

  10. On the Schema Options page, select Create a new schema from a CSV file, and click Next.

  11. On the Format Definition page, browse for and select a CSV file that maintains the response file structure (for this example, result.csv), and click Next.

  12. On the Summary page, review your selections, and click Done.

Drag an FTP Adapter Connection Inside the For Each Action

  1. Drag an FTP Adapter connection into the For Each action and below the Stage File action you just configured to read the batch results file.

  2. In the Adapter Endpoint Configuration Wizard, provide an endpoint name, and click Next.

  3. On the Operations page, specify the following details:
    • Select Write File from the Select Operation list.

    • Specify an output directory for the file.

    • Specify a file name pattern.

  4. On the Schema page, create a schema using a sample bulk file (for this example, response.csv).

  5. Select a CSV file that maintains the response file structure, and click Next. For this example, the same CSV file used for the stage file action is used.

  6. Review your selections on the Summary page, and click Done.

Configure Mapping for the FTP Adapter Connection

  1. Click the mapper above the FTP Adapter.

  2. Map the stage response elements to the FTP request elements.

  3. Click the mapper below the FTP Adapter.

  4. Map the SOAP Adapter response with the GetAllBatchStatus response (the SFDC_GetAllBatchStatus response elements to the SOAP response object).

  5. Validate the mapping, and click Close.

Add a Tracking Variable

  1. In the navigation pane, click Observability, then Instances..

  2. Configure a tracking variable, and click Done.

    The completed integration looks as follows without any errors and warnings.

  3. Save and close the integration.

    The Integrations page is displayed.

Activate the Integration

  1. On the Integration page, hover your cursor over the integration, and click Activate Activate icon.

  2. If needed, select the Enable Tracing check box, then the Include Payload check box.

  3. Click Activate.

    The integration is deployed and the web service is ready to accept requests.