Workarounds for tSalesforceOutputBulkExec NPE in case of empty flow

Fifteen Stars TRF
Fifteen Stars

Workarounds for tSalesforceOutputBulkExec NPE in case of empty flow

With TDI 6.3.1, having an empty flow as input cause tSalesforceOutputBulkExec to fail with a null pointer exception.
It was not the case with 6.2.x and previous versions.
 
Fortunately, there is at least 2 workarounds I want to share with anyone concerned by Salesforce integration.
 
1- store the flow in a tHashOutput, then link it to a tHashInput with a conditional link and finally, link the tHashInput  to tSalesforceOutputBulkExec:
 Capture.PNG
The conditional expression is the following:
((Integer)globalMap.get("tHashOutput_12_NB_LINE")) > 0
Use this workaround for a flow of limited size else you risk to encounter a memory exception.
Also tick the "Clear cache after reading" option for tHashInput component if you don't need to reuse the content anymore after this operation.
 
2- replace the tSalesforceOutputBulkExec component by a tSalesforceOutputBulk linked to a tSalesforceOutputExec with a conditional link:
Capture.PNG
 
In this case, the conditional expression is:
((Integer)globalMap.get("tSalesforceOutputBulk_1_NB_LINE")) > 0
No limitation regarding the flow size with this solution as tSalesforceOutputBulk use a file (the same as for tSalesforceOutputBulkExec), so you may prefer it if you have to manage huge flows.
 
Advantage, for these 2 solutions compared to tSalesforceOutputBulkExec is you have fewer calls to the Salesforce Bulk API (because you will not make calls for empty flows anymore).
 
Hope this will help you.

TRF
Highlighted
Forteen Stars

Re: Workarounds for tSalesforceOutputBulkExec NPE in case of empty flow

really not only tSaleForce have problems with empty flow, many components have similar "issue"

 

I use second way - count records (or check file exists in some cases) + runIf trigger

-----------

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch