0

I have a requirement where i want to display all salesforce objects in visual force page.

After salesforce object selection, list its parent objects and relational key attribute name of current object.

ex: If user selects opportunity, display Account as parent SObject and AccountId as relational attribute key.

It should work with both standard and custom objects

Can someone guide me how to achieve this.

  • 3
    Your question is missing key details. What have you tried so far? Is this lightning or classic? Are you trying to build a VF page or Lightning Component? Unless you provide these details, your effort, the point where you are stuck there is very less that anyone can do here to help. – Jayant Das Nov 26 '19 at 14:06
2

You would describe the object to get its DescribeSObjectResult, then loop through each field, check its DisplayType to make sure it is a "reference", and if so, grab the relationship name and field name. See also the DescribeFieldResult class.

Not the answer you're looking for? Browse other questions tagged or ask your own question.