You need to sign in to do that
Don't have an account?
Damon Long
Converting Trigger to Class
Hey everyone,
I need some help converting my Apex trigger into a class. I am just unsure about the syntax differences between the trigger and class and I'm aware that I can't use trigger.new in the class. Do I need to create a new list to be able to use trigger.new? Any help or direction would be greatly appreciated!
Trigger:
I need some help converting my Apex trigger into a class. I am just unsure about the syntax differences between the trigger and class and I'm aware that I can't use trigger.new in the class. Do I need to create a new list to be able to use trigger.new? Any help or direction would be greatly appreciated!
Trigger:
trigger TotalAumUpdate on Account (after update) { for(Account acc : Trigger.new){ Account oldAcc = Trigger.oldMap.get(acc.Id); if(oldAcc.Total_AUM__c != acc.Total_AUM__c){ List<Opportunity> opps = [SELECT Id, AccountId, Current_Balance__c from Opportunity where AccountId = :acc.Id]; List<Opportunity> newids = new List <Opportunity>(); for(Opportunity opp: opps){ if(opp.Current_Balance__c != acc.Total_AUM__c){ opp.Current_Balance__c = acc.Total_AUM__c; newids.add(opp); } } if(newids.isEmpty()== false){ update newids; } } } }
Please check once below code :
Hope this helps you.
If it helps you please mark it as best Answer.
Thanks
Varaprasad
For Support: varaprasad4sfdc@gmail.com
All Answers
Please check once below code :
Hope this helps you.
If it helps you please mark it as best Answer.
Thanks
Varaprasad
For Support: varaprasad4sfdc@gmail.com