We will be using workbench as a tool in this this article.
For example, you have two objects called ‘Reservation__c’ and ‘Address__c’. ‘Reservation__c’ object has lookup field called ‘Billing_Address__c’ that is lookup to ‘Address__c’.
‘Address__c’ object has External Id field called ‘Location_Id__c’.
Assume that we already have records populated in Address objects. For example
Id | Street Name | City | State | Country | Zip Code | Location Id |
02i2D000002IggvQAC | Glenn Rd | Atlanta | GA | USA | 33012 | 6714 |
02i2D000002IggvQAC | Jorge Rd | Miami | FL | USA | 32142 | 6715 |
and While creating Reservation records, you want to link Reservation with Address records using external id i.e. Location Id.
- Open Workbench
- Login to workbench.
- Go to ‘Rest Explorer’ under ‘Utilities’ tab.
- Select POST
- Put ‘/services/data/v47.0/sobjects/Reservation__c/’
- In the body put below JSON and click on Execute button.
Payload will looks like this:
{
"Name" : "UTB0502",
"Address__r" :
{
"Location_Id__c" : "6714"
}
}