You need to sign in to do that
Don't have an account?

Error : unexpected token public
Hi ...
I am new to sfdc ....please help me this issus
trigger HelloWorld on Account (before insert , before update) {
List<Account> aaa=Trigger.new;
MyHelloWorld my=new MyHelloWorld();
my.addHelloWorld(aaa);
}
public class MyHelloWorld{ ------------------the error show msg like Unexpected token : public
Public void addHelloWorld( List <Account> aaa){
for(Account acc:aaa){
if(acc.Hello__c!='World'){
acc.Hello__c='World';
}
}
}
}
Hi kirsh123,
1. Create your trigger handler class by going to Your Name | Setup | Apex Classes | New
2. Create your trigger by going to Your Name | Setup | Customize | Accounts | Triggers
All Answers
Hi kirsh123,
I don't think you can have a class in a trigger.
Why don't you check out the solution on this page which provides you an exmaple of a trigger class, a handler class, and also a test class for your trigger. Be sure to use your own object names and fields.
Let me know if you are still having difficulties :-)
Hi Zachbarkley ...Thanku for reply
But I am not geting your point so please tell me step by step
Hi kirsh123,
1. Create your trigger handler class by going to Your Name | Setup | Apex Classes | New
2. Create your trigger by going to Your Name | Setup | Customize | Accounts | Triggers