You need to sign in to do that
Don't have an account?
dharmik thummar
I want Soql outside of for loop.
I want [select id,Amount from Opportunity where Fund__c =: funRec.Id] outside of for loop.
for(Fund__c funRec : [select id from Fund__c where id in :fundIds]) { oppMap.put(funRec.Id, [select id,Amount from Opportunity where Fund__c =: funRec.Id]); fundMap.put(funRec.Id, funRec); }
Please find below code to avoid query inside for loop: Please let mark as best answer if helped. Please let me know incase you need any further assistance.
Regards,
Ramakant
and Method does not exist or incorrect signature: void put(Id, Opportunity) from the type Map<Id,List<Opportunity>> is the error now.
My complete code is like
Hope this will work.
Regards,
Ramakant
Please try below code: