function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Didier HDidier H 

Bulk API Data Loads, empty External Id Lookup

Hi,

I am trying to upsert account using the Bulk Api of DataLoader, I put a externalId field on account (ExternalId__c) but I have a problem with relationships: I can't upsert relationshipField to Null (using '#N/A').

Here is my CSV I'm trying to upsert:
  • Account 1 which is not part of a group hierarchy
  • Account 2, which belong to group 'g1'. Group g1 already exists in my Salesforce environment
name,external_id,parent
"Account 1","a1","#N/A"
"Account 2","a2","g1"
Here is my sdl file
name=Name
external_id=external_id__c
parent=Parent\:external_id__c
I'm using the bulk API, so the parent shoud be set for Account 2 and null for Account 1. But there is an error on account 1: 
"Id","Success","Created","Error"
"","false","false","MISSING_ARGUMENT:external_id__c not specified:--"

When I use the standard Api, everything works fine, the parentId is set to null, but the #N/A fields doesn't seem to work on lookup fields for bulk API

I've looked around and read this discussion:
https://developer.salesforce.com/forums?id=906F00000008mkMIAQ
DennisThong says that to put null values one must write the SDL this way:
name=Name
external_id=external_id__c
parent=ParentId
The problem with this solution is that when parent is populated, the external Id lookup wouldn't work (and Account 2 would'nt be upserted)

I also try this solution (Adding column parent2 to my csv):
name=Name
external_id=external_id__c
parent=ParentId
parent2=Parent\:external_id__c
But then, Salesforce answers that :
"Id","Success","Created","Error"
"","false","false","INVALID_FIELD:Cannot specify both an external ID reference Parent and a salesforce id, ParentId:--"
Does someone already had the same problem and solved it?

Thanks



Best Answer chosen by Didier H
Didier HDidier H
Ok I think I found it:

When using BulkApi with Dataloader, you must use "#N/A" to upsert to null values, exept for external id lookup fields where you can just put a empty value.
So my working csv file:

name,external_id,parent
"Account 1","a1",""
"Account 2","a2","g1"

and the same sdl file