Forteen Stars TRF
Forteen 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:
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:
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.

Twelve 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