+ Start a Discussion
JackOdellJackOdell 

Drawbacks to using foreign keys with the REST API?

Hey folks. 

 

Our team needs to be keep records in synch between our app and Salesforce.  We will be updating PersonAccounts and Cases.  

 

We're considering using the REST API to update the records using a foreign key from our app.

 

Can anyone think of any drawbacks to using foreign keys with the REST API?  Are there things we won't be able to do?  Would it be more advantageous for us to store the Salesforce record ID in our app?

 

Thanks in advanced.

Best Answer chosen by Admin (Salesforce Developers) 
Pat PattersonPat Patterson

I can't think of any drawbacks in particular. External IDs were designed especially for this kind of use case, and are well supported by the REST API - you can do an upsert against the external ID without knowing the Salesforce record ID.

All Answers

Pat PattersonPat Patterson

I can't think of any drawbacks in particular. External IDs were designed especially for this kind of use case, and are well supported by the REST API - you can do an upsert against the external ID without knowing the Salesforce record ID.

This was selected as the best answer
JackOdellJackOdell
Thanks, Pat! It does seem like the REST API supports their use well. It even allows you to specify the Id of a related object using external Ids (which we will need to do).

One minor drawback that I discovered as I thought it through is that without a record Id we will no longer be able to build links from our app to Salesforce records. To work around that, I will likely need to build a Visual Force page that will accept an external Id as a URL parameter and will redirect to the record's page.