0

Is it possible to upload lots of records, specifying different fields using conn.bulk.load?

E.g.:

let accounts = [];
let account1 = { Name : "Steve", AccountNumber : "123", RecordTypeId : "one record type" };
let account2 = { Name : "Jim", Site : "Home", RecordTypeId : "another record type" };
accounts.push(account1);
accounts.push(account2);
conn.bulk.load("Account", "insert", accounts);

In this example, the Site is not updating on the second account. Is there a way to get this to work?

1 Answer 1

1

The Salesforce Bulk API doesn't support specifying different fields in different records. In this case, jsforce is taking the fields from first record and using that to generate a CSV file to upload to the Bulk API, hence it is ignoring Site field because it was not there in first record.

The Salesforce Batch API supports updating different fields in different records. But it only supports max 200 records per API call. So if you are within that limit, give the Batch API a try.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .