Some time ago I've started to use Python with Pandas and Simple-Salesforce to make data migration to Salesforce orgs.
I want to insert Account records and Contact records that have lookup to Account records. Instead of a Salesforce record ID of a related record, I want to use an external ID to associate/connect records.
When I'm making this kind of insert operation for Contact records with Salesforce Inspector instead of using AccountId
field I can use Account.ExternalId__c
, with Data Loader it's Account:ExternalId__c
.
What is a notation that should be used for simple-salesforce
? When I'm using Account.ExternalId__c
or Account:ExternalId__c
I'm receiving this error:
simple_salesforce.exceptions.SalesforceMalformedRequest: Malformed request _https://xxx.my.salesforce.com/services/async/42.0/job/some_id/batch/some_id2/result. Response content: {'exceptionCode': 'InvalidBatch', 'exceptionMessage': 'Records not processed'}
I'm using this simple-salesforce
method to insert records:
sf.bulk.Account.insert(data_json, batch_size=100, use_serial=False)
Of course when I'm trying to import related records by Data Loader or Salesforce Inspector everything is working fine, so I'm guessing that it's issue with notation in Simple-Salesforce.