Using KingswaySoft to Work with Salesforce Bulk API

26 September 2022
KingswaySoft Team

While working with Salesforce integrations, if you have a large number of records that you need to read or write and the process is taking longer than anticipated, then you may benefit from using the Bulk API feature provided by Salesforce. The Salesforce Bulk API is extremely useful to speed up the process, thereby getting maximum performance for larger volumes. Not just for write actions, but Bulk API can also be used for large-scale read or data retrieval processes. The Salesforce Bulk API will read/write those records from/to your Salesforce organization, which, when set up properly, improves performance by using parallel processing and fewer network round trips. Our KingswaySoft Salesforce Source and Destination components both support Bulk API. Today we will look at the feature and do a walk-through using a simple demonstration of how to write bulk data to a Salesforce object using this feature.

In this blog post, the KingswaySoft components we will use to perform the Bulk API task are listed below:

Design and configuration

The design for the case study is shown below and should be a quick setup. The first data flow (Bulk API Load) loads data into Salesforce, and the second data flow (Retrieve Bulk Job Id Variable) retrieves the bulk job id. Additionally, we have added a part to save the Job Id to a database table; however, it can be used per your requirement in the downstream data flow.

control-flow-view

Bulk API Load data flow

The Data Spawner component will create some sample data: 100,000 records for our test today, which will get loaded into the Salesforce Destination component. The last Dummy Destination component, which acts as a data flow destination component here, will be included in the scenario where the Salesforce Destination component needs a default output connected to any Destination component (which we will see why in later sections), and in the other cases, the Destination component will be removed.

ulk-api-load-dataflow

When using KingswaySoft’s Salesforce Connection Manager and choosing SOAP as the service endpoint, you will have a few options available that you can set, as shown below. If you would like to read more on each of these options, visit the help manual for the Salesforce Destination component provided at the beginning of this blog post.

salesforce-destination-SOAP

When using KingswaySoft’s Salesforce Connection Manager and choosing REST as the service endpoint, the only option under the Bulk API section you can change is whether to Use Bulk API or not. The grayed-out options are handled by the service, so you will not be able to change them. The available options will be auto-selected by the service to get the best performance. And lastly, the batch size cannot be selected, as it uses the buffer memory.

salesforce-destination-REST

Retrieve Bulk Job Id Variable data flow

You would see that even in this data flow, a Data Spawner component is being used. The Data Spawner component here is used as a dummy source (creating a null record), while the Premium Derived Column component is a transformation component and requires a primary input. The Premium Derived Column will just store the bulk id variable in a column.

retrieve-bulk-job-id

Then, further downstream, we have added a Premium ADO.NET Destination component to store the sfbulkJobId column in a table.

Write bulk Id to table

Test and results

There are four tests we ran, each one processing 100,000 records:

  • Case 1: REST connection with Bulk API enabled and Salesforce Destination default output connected to a Dummy Destination component. This is typically used if you wish to get feedback when the action is complete and requires the SalesforceRecordId in the downstream data flow process.
  • Case 2: REST connection with Bulk API enabled and Salesforce Destination default output not connected.
  • Case3: SOAP connection with Bulk API enabled and Salesforce Destination default output connected to a Dummy Destination component. This is typically used if you wish to get feedback when the action is complete and requires the SalesforceRecordId in the downstream data flow process.
  • Case 4: SOAP connection with Bulk API enabled and Salesforce Destination default output not connected.

Now, let's look at the difference between REST and SOAP Connection Managers in relation to the Bulk API, as well as the impact of a default output connected to a component, or having no downstream component connected to the default output when the data flow is executed.

When you test this yourself, you will notice that:

  • When Bulk API is enabled, and there is no default output connected to the Salesforce Destination, we received the full benefits, a significant reduction in processing time, and the process was asynchronous.
  • On the other hand, when Bulk API is enabled, and the Salesforce Destination component has a default output, the benefits are lost to a degree but still work faster than a regular batch process.
  • Both REST and SOAP are affected when adding a default output.
  • Lastly, in our simple tests, the REST and SOAP connections had a similar reduction in processing time, so in more complex scenarios you would need more testing to see which one meets your requirements.

Conclusion

To sum up what we have observed above, having no component connected to the Salesforce's Destination component default output means we get the full benefit of Bulk API speed (the process is asynchronous). However, any server data errors will not be displayed and would need to be checked from the Salesforce side using the bulk Job ID, which, as we have seen in the second data flow task, can easily be logged. Lastly, the default output connected to another downstream Destination component as the SalesforceRecordId needs to be retrieved. Thus, using KingswaySoft Salesforce components, data processing can be simplified and performed at a high-performance rate with the Bulk API.

We hope this has helped!

Archive

November 2024 3 October 2024 1 September 2024 1 August 2024 2 July 2024 1 June 2024 1 May 2024 1 April 2024 2 March 2024 2 February 2024 2 January 2024 2 December 2023 1 November 2023 1 October 2023 2 August 2023 1 July 2023 2 June 2023 1 May 2023 2 April 2023 1 March 2023 1 February 2023 1 January 2023 2 December 2022 1 November 2022 2 October 2022 2 September 2022 2 August 2022 2 July 2022 3 June 2022 2 May 2022 2 April 2022 3 March 2022 2 February 2022 1 January 2022 2 December 2021 1 October 2021 1 September 2021 2 August 2021 2 July 2021 2 June 2021 1 May 2021 1 April 2021 2 March 2021 2 February 2021 2 January 2021 2 December 2020 2 November 2020 4 October 2020 1 September 2020 3 August 2020 2 July 2020 1 June 2020 2 May 2020 1 April 2020 1 March 2020 1 February 2020 1 January 2020 1 December 2019 1 November 2019 1 October 2019 1 May 2019 1 February 2019 1 December 2018 2 November 2018 1 October 2018 4 September 2018 1 August 2018 1 July 2018 1 June 2018 3 April 2018 3 March 2018 3 February 2018 3 January 2018 2 December 2017 1 April 2017 1 March 2017 7 December 2016 1 November 2016 2 October 2016 1 September 2016 4 August 2016 1 June 2016 1 May 2016 3 April 2016 1 August 2015 1 April 2015 10 August 2014 1 July 2014 1 June 2014 2 May 2014 2 February 2014 1 January 2014 2 October 2013 1 September 2013 2 August 2013 2 June 2013 5 May 2013 2 March 2013 1 February 2013 1 January 2013 1 December 2012 2 November 2012 2 September 2012 2 July 2012 1 May 2012 3 April 2012 2 March 2012 2 January 2012 1

Tags