You need to sign in to do that
Don't have an account?
raj jordan
i have created a custom field on account object along with one checkbox field and another custom field on custom object pricing and written a trigger such that when the check box field is selected the pricing should also get inserted
Now i want these trigger code in apex class and i want to call that apex class in trigger
below is my code
can anyone please help me through this
Thanaks in Advance
below is my code
trigger insertobject2 on Account (after insert, after update) { Set<Id> Ids= new Set<Id>(); for (Account acc : Trigger.new) { Ids.add(acc.Id); } List<Account> accList = new List<Account>(); accList=[Select Id,name,SynctoPricing__c,Relatedpricing__c From Account where Id in :Ids]; for(Account temp : accList ) { if(temp.SynctoPricing__c==true){ Pricing__c pri = new Pricing__c(); pri.RelatedAccount__c = temp.Relatedpricing__c ; insert pri; } } }
can anyone please help me through this
Thanaks in Advance
Please check below post to learn about trigger framwork
1) http://amitsalesforce.blogspot.in/2015/06/trigger-best-practices-sample-trigger.html
Update your code like below
Handler class like below
Let us know if this wll help you
All Answers
Please check below post to learn about trigger framwork
1) http://amitsalesforce.blogspot.in/2015/06/trigger-best-practices-sample-trigger.html
Update your code like below
Handler class like below
Let us know if this wll help you
thanks for ur help
if so can you please help me
thanks in advance