You need to sign in to do that
Don't have an account?
Micky M
Map
Hi all does anyone know how i can create a map which has an id then a list of opportunities associated with it?
something like
map<string, List<Opportunity>> oppMap = newmap<string, List<Opportunity>>([select o.Sugar_ID__c, o.id from Opportunityo where AccountId = null]);
where the Sugar_ID__c is the key and the opp id is the value, i know what i need to do just not sure how to do it.
Thanks All
You could query for all Opportunity records where AccountId is null, and put that in a single list. Then declare the Map:
Loop through the opportunities. First step is to see if the key exists. If it doesn't, add it.
Then add the Opportunity record to the collection of the corresponding Map value.
(exact syntax may vary)
All Answers
You could query for all Opportunity records where AccountId is null, and put that in a single list. Then declare the Map:
Loop through the opportunities. First step is to see if the key exists. If it doesn't, add it.
Then add the Opportunity record to the collection of the corresponding Map value.
(exact syntax may vary)
Thats it sir, thats pretty much done what i need to thanks for your help!