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
ABCDEFGHIJKLMNOABCDEFGHIJKLMNO 

Determining Foreign Key Relationships Programmatically

I have a need to determine FK relationships programmatically. The goal is to be able to programmatically order data loads so that data needed by later relationships is loaded before-hand. I see on the Apex Explorer that it knows what the relationships are, but I don't see anything in the docs that explains how it knows.

 

On other databases in the past, I have been able to inspect the foreign key, identify the foreign table, look up the corresponding value, and replace it -- all programmatically. Is this possible for SF? 

 

Any ideas?

Best Answer chosen by Admin (Salesforce Developers) 
ABCDEFGHIJKLMNOABCDEFGHIJKLMNO

Half the battle is known what things are called -- I never searched on references.

 

Thanks!

All Answers

SuperfellSuperfell
See the describeSObject API call.
ABCDEFGHIJKLMNOABCDEFGHIJKLMNO

Half the battle is known what things are called -- I never searched on references.

 

Thanks!

This was selected as the best answer