Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
CCS
New Member

Lookup Salesforce Parent Object Id using External ID

Hello,

 

In Salesforce, you can use an External ID field to link a child record to a parent record. You can use an External ID in place of a record's ID when associating records.

We try to use pipeline to bulk upsert records  in Salesforce, however, there is no option to lookup (map) to parent object using the parent's external Id. 

In this case, we need to upsert Opportunity which requires Contact ID. We do have the Contact External ID, but not the Contact Salesforce ID. 

Any suggestion how to accomplish this?

 

Thanks

2 REPLIES 2
Anonymous
Not applicable

Hi @CCS ,

Here are my own thoughts about your questions:

 

1. You need to query Salesforce to get the Contact ID based on the Contact's External ID. You can use the REST API to perform this query. Here's an example of how to do this:

GET /services/data/vXX.X/sobjects/Contact/External_ID_Field__c/External_ID_Value

Replace XX.X with your API version, External_ID_Field__c with the API name of your External ID field, and External_ID_Value with the actual External ID value.

 

2. The response will include the Contact ID, which you can then use in your upsert operation.

 

3. You have the Contact ID, you can proceed to upsert the Opportunity. Here's an example of how to do this using the REST API:

PATCH /services/data/vXX.X/sobjects/Opportunity/Opportunity_External_ID_Field__c/Opportunity_External_ID_Value
Content-Type: application/json

{
    "Name": "Opportunity Name",
    "StageName": "Prospecting",
    "CloseDate": "2025-12-31",
    "ContactId": "Contact_ID_Value"
}

Replace Opportunity_External_ID_Field__c with the API name of your Opportunity's External ID field, Opportunity_External_ID_Value with the actual External ID value, and Contact_ID_Value with the Contact ID you retrieved earlier.

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for the reply Yilong, but this solution doesn't work for bulk upserts. We need to upsert 100K+ records daily (and in a case of data migration much more) and bulk upload is the only way due to the 15K batches in a 24-hour period limit.

Helpful resources

Announcements
August Fabric Update Carousel

Fabric Monthly Update - August 2025

Check out the August 2025 Fabric update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.