• Raul Haynes
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 4
    Replies
Hi I am looking to do a rollup of my Investment object based on the Account ID I select for some reason its not working. If I hard code the Account ID as a test it works correctly. Can anyone help me get past this issue? 

trigger ConsultingAUMRS on Account (before update)

  
System.debug('++++++++++++ before update trigger +++++++');
     
    
    for (Account a :Trigger.new)
    {
     
           set<Id> acctIds = new set<Id>();
           acctIds.add(a.Id);
           
    
       
     AggregateResult ar = [select sum(AUM__C)total from Investment__c Where Consultant__c !=null and Org_ID__c =:acctIds];
    
System.debug('++++++++ total (double) ' + (Double) ar.get('total')); 
        
     a.Total_Consultant_AUM__c = (Double) ar.get('total');


   }
}
Can anyone help explain why my trigger wont fire?  I am really stumpped.  Any help is much appreciated. 

trigger ConsultingAUMRS on Account (before update, after update) { system.debug ('Raul');{
Account Rollup = new Account();
    for (AggregateResult ar:[select sum(AUM__C)total from Investment__c Where Consultant__c !=null])
{
  system.debug('Hello1');
      Rollup.Total_Consultant_AUM__c = (decimal)ar.get('total');
       system.debug((decimal)ar.get('total'));
   }
}
}
 
Can anyone help explain why my trigger wont fire?  I am really stumpped.  Any help is much appreciated. 

trigger ConsultingAUMRS on Account (before update, after update) { system.debug ('Raul');{
Account Rollup = new Account();
    for (AggregateResult ar:[select sum(AUM__C)total from Investment__c Where Consultant__c !=null])
{
  system.debug('Hello1');
      Rollup.Total_Consultant_AUM__c = (decimal)ar.get('total');
       system.debug((decimal)ar.get('total'));
   }
}
}