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
priya burghatepriya burghate 

how to use lookup relationship in data insertion in dataloader through command prompt?

Hi all,
I want to know
how to use lookup relationship in inserting the accounts in salesforce from dataloader through command promt.
Sumitkumar_ShingaviSumitkumar_Shingavi
Basically, Lookups store "Id" of record your are trying to attach to it. So, if You can to populate Account on Contact, you do like below:
conInstance.AccountId = accInstance.Id;
So if you want to do same in CSV file which are going to push through CommandLine then Column name should be "AccountId" and value should be "001xxxxxxxxx" [Id of Account which need to be linked to Contact].

Similarly, in your case; you need to put right API name (API name of field) as column name and then put "Id" of the record you want to link it with.

PS: if this answers your question then hit Like and mark it as solution!
priya burghatepriya burghate
@SumitKumar_Shingavi

Can you please explain it with the help of external id.

Im inserting accounts in account . by using contact and account obj can you plz tell me what changes should be doen in my csv , process-config, and mapping file

Sumitkumar_ShingaviSumitkumar_Shingavi
The External ID field allows you to store unique record IDs from an external system, typically for integration purposes. External Id data type can be text, number or email field types. Values in these External ID field must also be unique and you can also determine whether or not value are case sensitive.

There are three ways that you typically use External ID field.

Loading Data from External Systems: When you load data from external systems you may want to track the record from the external system for reference or if you want to make updates back into the external system. Simply mark a field as an External ID and the Force.com platform will ensure that each value is unique and that you don’t load duplicate records from the external system.

Data Integration: This is the External ID field really earns its keep. When using the upsert command during data loading, you can reference the External ID field instead of the Salesforce ID. This is a huge advantage because you typically don’t want to maintain the Salesforce ID in your external system. When uploading data with the Import Wizard, Data Loader or (most) ETL tools like Boomi or Informatica, there is a setting to specify that a field is an External ID.

Where we use: The Salesforce API supports the use of External ID fields as foreign keys in place of IDs, but this feature is not yet supported in the SalesforceUpsert step. For example, if there is an External ID on Account named External_Account_Key__c, a Contact can be created as a child of an Account using the value of this External ID rather than the Account Id. See "upsert() and Foreign Keys" at http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_upsert.htm

The way that Data Loader supports specifying an External Id for a foreign key is "Account:ExternalId__c".

So, Contact field will be target sfdc field (which is AccountId) and Mapped to Account\:ExternalId__c in Data Loader

PS: if this answers your question then hit Like and mark it as solution!