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
punit.theikospunit.theikos 

Getting the list of related objects for accounts

Hi,

We have a requirement of finding related objects for an account ID including Salesforce Objects and Custom objects that are related to accounts. The application is similar to what merge account utility provides. we want to merge all the related objects (Custom/salesforce provided) from one account to another.

Any help would be greatly appreciated.

Thanks

Punit

SuperfellSuperfell
First thing is to find all the relationships to account, As of today, that requires you to call describeSObject on every type and look for foreignKeys to account. Once sforce 6.0 is out, this gets much simplier, you'll be able to call describeSObject just on account, and that will include a section that details all the foreignKeys back to account. Then its just a matter of using that info to build all the correct queries for the account id(s) you have.