I am getting Account servicing records which are linked to accountpublic class Account_Related_Account_Servicing { List<Account_Servicing__c> Accountservicing_records = new List<Account_Servicing__c>(); Map<Id,Map<Id,List<Account_Servicing__c>>> Account_RelatedRecords = new Map<Id,Map<Id,List<Account_Servicing__c>>>(); Map<Id,List<Account_Servicing__c>> listrecords = new Map<Id,List<Account_Servicing__c>>(); Public void Account_Linked_Account_Servicing_Records() { Accountservicing_records = [select Id,Account__r.Id,Name from Account_Servicing__c where Account__c != Null ]; for(Account_Servicing__c abc:Accountservicing_records) { if(listrecords.containsKey(abc.Id) ) { listrecords.get(abc.Id).add(abc); } else { listrecords.put(abc.Id,new List<Account_Servicing__c>{abc}) ; } // In this how to write the code
if(Account_RelatedRecords.containsKey(Account__r.Id) )
{
Account_RelatedRecords.get(Account__r.Id).add(abc);
}
else
{
Account_RelatedRecords.put(Account__r.Id,Map<Id,List<Account_Servicing__c>>) ;
}
} System.debug(Account_RelatedRecords); } }
2 réponses
Hi Srikanth,Can you elaborate on the use case with an example so as to check further and respond back.Thanks.