Sunday, August 11, 2019

Accessing Child Records from sObjects using getSobjects method

Dynamic queries plays very important role when we need to run different SOQL based on different inputs. By using dynamic apex, we can store the output of queries in sObjects list and then can even check if parent record contains any child records. Even if you want to fetch child record information then you can use "getSobjects('relationshipname') method to get child information.

Below is code snippet to get all opportunities and contacts information related to Account:

Hope this will help!!!


  1. This comment has been removed by the author.

  2. Thanks for sharing such a wonderful Post with us. I learnt alot from your post. I am appreciating from you to you will share more
    information about it. Please keep sharing. Thanks Alot
    Dell laptop Service Center in Ameerpet, Hyderabad.
    Best Laptop Service Center in Ameerpet, Hyderabad.