You need to sign in to do that
Don't have an account?
accessing a "detail" list from a master object record in a controller extension
Hello,
I'm quite new in SFDC.
I'm working on building a VF page, that needs to display the last transactions of a client, knowing that the object model is
each client has a list of accounts
each account has a list of holdings
and finally, each holding has a list of transactions (buy, sell ... )
Each of these parent - child relationships is done through a master - detail relationship.
For instance, for the client - account, the client is the master and the account the detail.
I' m trying to build a extension of the client standard controller where I will implement a method that returns this list of transactions starting with the stdController.getRecord() object. I'm ok with the algorithm that I have to implement.
My point is that I don't know how to access the detail list from the parent object in Apex.
For instance, when I look at the list of attribute for my client, I don't see the account list.
Thanks for your help !
One way would be to get the MasterIDs into a List or Set,then query the 'detail' records for those that have the MasterID. You can store the results in map<Id, List<object>> using the MasterID as the key, and the detail record as the object. that way, when you iterate over the master records, you can get all the detail records.