• #66336
    Salesforce | Prachi Prachi #10
    Forcetalks

    What is the user external id in the upsert operation? Which fields can be external id fields in Salesforce?

    What is the user external id in the upsert operation? Which fields can be external id fields in salesforce?

     

    #66345
    Salesforce | Yogesh Yogesh #22
    Forcetalks

    Hello,

    External ID is field in Salesforce to say that this field is primary key in external Database which can be used to identify that external record exists in Salesforce or not ? There are many benefits of external key like :

    It can be used to identify if record exists or not and record automatically inserted or updated using upsert operation
    Upsert operation is supported by Dataloader, Apex and API
    Any field marked as external id is indexed and can be used in SOQL or report filter
    You can create Parent child record in single statement in Apex
    Using Upsert operation to create/update child record and relate to existing parent record with help of External Id

    Lets assume that you have list of contacts and Account in external SQL Server database and you want to import those Account and contact weekly. It is possible that you have already imported contacts previously so don’t want to duplicate records if already created in Salesforce. To solve this problem we can use external Id on Contact and use upsert operation on dataloader. Let’s assume external Id field on Contact is “SQL_Server__Id__c” (I am assuming that Account records in Salesforce also have external Id and records are already imported. Same below steps can be used to import Account record as well).

    Launch Dataloader installed from Salesforce and make sure settings like “Batch Size”, “Server host”, “Start at row” are correct.
    Salesforce Dataloader Settings
    click on “Upsert” button.
    Login Window may appear, so enter your Username and Password+Security token.
    Select “Contact” object in next window and choose CSV file of contact you want to import in Salesforce.
    It will alert informing total number of records going to be processed, click OK.
    In next screen , you will be prompted to select field from Contact which should be used by Salesforce to identify record and take decision that it needs to be updated or inserted. Id field and all fields which are marked as external Id will be listed here. Don’t expect this screen in any other operations except upsert.
    External Id choice in Upsert operation of Dataloader
    As shown in above image, select correct external Id field (in this case SQL_Server_Id__c) and click next.
    Next screen will show list of all Parent Object and each object will provide choice to select either Id field or external id field of Parent Object. This is one of amazing feature of Salesforce where Parent child relationship can be established with help of external Id (No need to use excel sheet Vlookup functions to extract 15 digit Salesforce Id to establish relationship). In this case example, we only want to create relationship with Account so we will use only Account’s external Id and leave others unselected.
    Create Parent child relationship using External Id in Dataloader
    At end of this article, I have provided Youtube Video link following same steps.
    In Next window we need to map CSV file field with Salesforce fields. One point to notice in below image, how we are mapping Parent Account’s External Id with contact record.
    Field Mapping to create Parent Child relationship using ExternalId in Salesforce
    Once all of above steps are followed, we can click on Next window and upsert operation will start. Salesforce will provide CSV file of success and failure results to perform post analysis of operation.

Viewing 2 posts - 1 through 2 (of 2 total)

Please to reply to this topic.

CONTACT US

We're not around right now. But you can send us an email and we'll get back to you, asap.

Sending

About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2020 Forcetalks. All Right Reserved.

Log in with your credentials

or    

Forgot your details?