You need to sign in to do that
Don't have an account?
Monin Savant
Remove soql query from loop
I need to take the request out of the loop to avoid limits. Where Opportunity__c field in Depositor__c its has master-detail relationships with Opportunity.
Thanks in advance!
Depositor__c[] depositors = trigger.new; for (Depositor__c item : depositors) { List<AggregateResult> resultAmount = [SELECT SUM(Amount__c)sum FROM Depositor__c WHERE Opportunity__c=:item.Opportunity__c];
Thanks in advance!
Can you please check if this works for you.
If this solution helps, please mark it as best answer.
Thanks,
It's prety easy. you need to copy & paste below code.
don't forget to mark it as best answer.
thank you