You need to sign in to do that
Don't have an account?
Tarent
Data loader with lookup relationship
I want to know how to use apex data loader to insert data for the objects which have lookup relationship with other objects.I mean what data I put for these fields in csv file.
Hi,
For creating the relationship via lookup field when inserting the data from data loader. Put a column of name as api name of lookup field in your csv file and put the ids of lookup object from which you want to associate the Childs records.
For example:
Suppose you want to associate a contact con1 with account acc1 then create a column as accountid and put the id of acc1 in this column and associate the contact con1.
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
I do a lot of work with dataloader at the command line, and it is possible to import data and have the relationships connect. If you're interested, let me know and I'll post more specifics.
Here's an under-used capability of dataloader.
Let's say we're importing purchase orders and purchase order lines from a foreign system (like a DB) into Salesforce. The PO lines should include the PO number so the lines can relate to the POs. In Salesforce, the PO object will (or should) include an "external id" field which is the same PO number as the lines will have.
Your mapping file (often with an .sdl extension) could have a line like:
What that says is take the po_number field on the incoming PO lines and relate the new line in Salesforce with its parent Purchase_Order__c object, using the relationship Purchase_Order__r's external id field PO_Number__c.
Another example is loading Accounts from an external system where those accounts have a relationship to each other and that relationship should be preserved in Salesforce via an account's parent field.
If you added an external id field for the foreign DB, then those relationships can be preserved using \:.
Where "external_id_field__c" should be replaced by whatever the external id field's name is in your system's Account object.
The graphical data loader knows how to do this--but only on UPSERTs. It will allow you to graphically identify the lookup-fields for relationships and if you save the mapping file, you'll see this notation inside it for each of the relationships.
I haven't found a lot of documentation on this feature of the data loader anywhere.
Let me know if this gets you closer.