You need to sign in to do that
Don't have an account?
Andrew Gray
check nested map
When looping the list aes - I want to know if a Trading_Relationship__c exists with same Cust__c/Supp__c values. Am trying to put all TRs into nested list to check against. Is that easiest way and how do I check in the loop? Thanks
List<Trading_Relationship__c> trs = [SELECT Id, Customer__c, Supplier__c FROM Trading_Relationship__c]; Map<Id, List<Id>> trmap = new Map<Id, List<Id>>(); for(Trading_Relationship__c tr: trs) { trmap.put(tr.Customer__c, new List<Id>()); } for(Trading_Relationship__c tr: trs) { trmap.get(tr.Customer__c).add(tr.Supplier__c); } for(Agent_Engagements__c ae: aes) { //ae.Cust__c //ae.Supp__c ?? }
All Answers