+ Start a Discussion
Diego NietoDiego Nieto 

Using jsforce bulk load recieve the error "ClientInputError: Unable to find any data to create batch"

Hi everyone

i'm working on an integration process using jsforce and bulk load operation. I'm sending 257 records but they could be more later. I could send 20 records and it seems that it worked, but when I sent the complete Data I have the error "CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY:LeadTrigger: System.LimitException: Too many future calls:"  wich is correct because I'm using a trigger that calls an API from one of our providers. The option that i had was to send from 20 to 20 till end the Data records. I tried like this
 
var maxLeadNumber = getLength(newLeadList);
        var mod = maxLeadNumber % config.leadSendSize();

        var numberOfSend = ((maxLeadNumber - mod)/config.leadSendSize())+1;
        var recordsCounter = 0;
        for(var i = 0;i<numberOfSend;i++){
            conn.bulk.load('Lead','Insert',newLeadList.slice(recordsCounter,config.leadSendSize()),function(err,rets){
                if(err){return console.log(err);}

                for (var i=0; i < rets.length; i++) {
                    if (rets[i].success) {
                        console.log("#" + (recordsCounter + i+1) + " loaded successfully, id = " + rets[i].id);
                    } else {
                        console.log("#" + (recordsCounter + i+1) + " error occurred, message = " + rets[i].errors.join(', '));
                    }
                }

            });
            recordsCounter = recordsCounter + config.leadSendSize();
        }



and I had this error now 

{ ClientInputError: Unable to find any data to create batch
    at BulkApi.HttpApi.getError (D:\Zagalabs\Cipress Hill\SFIntegration\source\node_modules\jsforce\lib\http-api.js:250:13)
    at D:\Zagalabs\Cipress Hill\SFIntegration\source\node_modules\jsforce\lib\http-api.js:95:22
    at tryCallOne (D:\Zagalabs\Cipress Hill\SFIntegration\source\node_modules\promise\lib\core.js:37:12)
    at D:\Zagalabs\Cipress Hill\SFIntegration\source\node_modules\promise\lib\core.js:123:15
    at flush (D:\Zagalabs\Cipress Hill\SFIntegration\source\node_modules\asap\raw.js:50:29)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9) name: 'ClientInputError', errorCode: 'ClientInputError' }

may be i can be do wrong the send process. Can Anyone helpe with this please?