You need to sign in to do that
Don't have an account?
Upsert a custom object and lookup relation's external id using Bulk API
Hello all,
I am new to Salesforce and am currently trying to use the Bulk API to import data into my salesforce instance.
I have a custom object named Portal with an external id (ep_portal_id). Each portal object has a lookup relationship with an Account object. I have made a ep_partner_id field as an external id to the Account object.
So far I have successfully upsert portal objects with a reference to an Account object using the Account's salesforce object id (I am using the Bulk Example Java code from the Bulk API doc). Instead, I would like to upsert a Portal with a reference to the Account by using the Account's external id (ep_partner_id). I played around with the Data Loader and found out the syntax that works is like this in my CSV file:
ep_portal_id__c,Account__r:ep_partner_id__c,Name
333,222,"Floral Elegance"
However using the same CSV file when doing an upsert via Bulk API, Eclipse complains with: "stateMessage='InvalidBatch : Field name not found : Account__r:ep_partner_id__c'"
Does anyone know the correct syntax to use in my CSV file so that the Bulk API can do the upsert on updating a reference to an Account on my Portal object using the Account's external id?
Much thanks in advance!
Thanks Solees. I actually contacted helpline from Salesforce.
ep_portal_id__c,Account__r.ep_partner_id__c, Name
The <relation object>.<external id> syntax works. It didn't work for me when I had the external id at the end like :ep_portal_id__c, Name, Account__r.ep_partner_id__c so I believe that order matters.
All Answers
Bulk API doesn't understand relationships. You could try the non bulk API to clear this out.
cheers
Thanks Solees. I actually contacted helpline from Salesforce.
ep_portal_id__c,Account__r.ep_partner_id__c, Name
The <relation object>.<external id> syntax works. It didn't work for me when I had the external id at the end like :ep_portal_id__c, Name, Account__r.ep_partner_id__c so I believe that order matters.