I have below piece of code where I want to traverse to details from the base query on master object.
Apex code
Map<Id,set<Id>> MapOfAcctListItem = new Map<Id,Set<Id>>();
for(Account_List_vod__c cpc : [select Access_vod__c,Display_Order_vod__c,Icon_Name_vod__c,Id,Name,OwnerId,
(select ID,Account_vod__c,External_ID_vod__c
from Account_List_Item_vod__r)
from Account_List_vod__c
where OwnerId in :MapOfTierObj.keyset()
And Name =:ListName])
{
if(!cpc.Account_List_Item_vod__r.isempty())
{
if(!MapOfAcctListItem.containsKey(cpc.OwnerId)){
MapOfAcctListItem.put(cpc.OwnerId,cpc.Account_List_Item_vod__r);
}
else{
MapOfAcctListItem.get(cpc.OwnerId).addAll(cpc.Account_List_Item_vod__r);
}
}
}
I need to assign only Account_vod__c field values of in value section of MapOfAcctListItem Map instead of addAll(cpc.Account_List_Item_vod__r). How can i achieve that?