You need to sign in to do that
Don't have an account?

Bulk API Relationship Fields with CSV
Hi
I am trying to upsert contacts and accounts via the bulk API and all is working fine except the contact and accounts are not being connected to each other.
I am using a csv spec as described in the documentation to map my columns.
I have a custom external ID called 'User ID' (API name: 'User_ID__c') on my contact object AND on my account object.
I already have an Account record setup with a User id set as 5.
I also have a custom field called 'Display Name' on my contact object.
This is basically the batch CSV file I upsert to the Contact object.
Here is the spec CSV file I upload before the batch:
The batch is upserted fine and processed without any errors. But the account and contact is not connected. When I monitor the job batch by logging in to the website, and downlaod the request, it does not have the relationship field in it:
Do relationship fields work with CSV files? I can see there are issues with the XML version via another post
Please help
I am trying to upsert contacts and accounts via the bulk API and all is working fine except the contact and accounts are not being connected to each other.
I am using a csv spec as described in the documentation to map my columns.
I have a custom external ID called 'User ID' (API name: 'User_ID__c') on my contact object AND on my account object.
I already have an Account record setup with a User id set as 5.
I also have a custom field called 'Display Name' on my contact object.
This is basically the batch CSV file I upsert to the Contact object.
"User ID","Display Name","Account Relationship", "5","Mr Test","5",
Here is the spec CSV file I upload before the batch:
Salesforce Field,Csv Header,Value,Hint User_ID__c,"User ID",, Display_Name__c,"Display Name",, Account__r.User_ID__c, "Account Relationship",,
The batch is upserted fine and processed without any errors. But the account and contact is not connected. When I monitor the job batch by logging in to the website, and downlaod the request, it does not have the relationship field in it:
"Display_Name__c","User_ID__c","Mr Test","5",
Do relationship fields work with CSV files? I can see there are issues with the XML version via another post
Please help
So... it turns out that its the spec that creates the problem! I cannot have a relationship field in my upsert when using a spec.
If I upsert the contacts with an 'AccountId' column, with no spec, it creates the relationship properly.
Or if I upsert the contacts with a 'Account.User_ID__C' column, it creates the relationship as well. This was saves me querying all of the accounts I upload and mapping them manually.
Thanks Salesforce. You owe me a day of my life back.
I hope this saves someone else some hassle.
All Answers
.Then try using the excel feature vlookup to match accountIds related to your external Id field User_ID__c and then provide those accountIds as reference in your contact csv
So... it turns out that its the spec that creates the problem! I cannot have a relationship field in my upsert when using a spec.
If I upsert the contacts with an 'AccountId' column, with no spec, it creates the relationship properly.
Or if I upsert the contacts with a 'Account.User_ID__C' column, it creates the relationship as well. This was saves me querying all of the accounts I upload and mapping them manually.
Thanks Salesforce. You owe me a day of my life back.
I hope this saves someone else some hassle.
Hi BrockB
I'm facing the same issue today.