• Ishita sfdc
  • NEWBIE
  • 30 Points
  • Member since 2018

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
Hi all - We need to query a list of parent IDs for which all related record have a status = closed. In our case, the parent object is Contact and children are a Custom Object. Once we have the list we'll update a field on the Contact.

Can someone help with the SOQL query / list part?

Thanks!
Hi all - We need to query a list of parent IDs for which all related record have a status = closed. In our case, the parent object is Contact and children are a Custom Object. Once we have the list we'll update a field on the Contact.

Can someone help with the SOQL query / list part?

Thanks!
I need to update a field on zone called total sales which display the total sales on agent object in that region

 
public class TotalSales {
    
     public TotalSales(){
         
         for(zone__c z : [SELECT Id,Total_Sales__C FROM Zone__C WHERE Name__c = 'North']){
             
             z.Total_Sales__C = [SELECT Sum() FROM Agent__C WHERE Total_Sales__c ='0' ];
            
            upsert z;

}
     }
}