You need to sign in to do that
Don't have an account?
![Steve Huse Steve Huse](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
How do I get my Apex trigger?
Hi All,
We use SF Professional edition with API and Workflow enabled.
I've become quite conversant with the administration of our Org since we adopted a year ago, but we now need an Apex trigger to automatically create a case when opportunity status = closed won, and am not really sure how to go about it.
Is the trigger something that can be written and added to our Org from the admin setup panel, and if not, please can someone let me know how I get this trigger written and added?
Thanks in advance.
Steve
Hi Steve,
Here you go: (you need to go to customize->opportunities->triggers and add the below code)
trigger autoCasecreation on opportunity(after update){
List<case> caseList = new List<Case>();
for(Opportunity opp: trigger.New){
if(opp.stageName=='Closed Won' && opp.stageName != System.Trigger.OldMap.get(opp.id).stageName ){
Case cs = new case();
caseList.add(cs);
}
if(!caseList.isEmpty()){
insert CaseList;
}
}
}
Thanks,
JBabu.
Perfect ... except !
customize->opportunities-> no 'triggers' link ?
We're using Professional edition with Workflow and API enabled ... do I need to get Apex functionality enabled?
Thanks
Steve
http://boards.developerforce.com/t5/Apex-Code-Development/Deploying-a-trigger-class-to-Professional-edition/td-p/266439
check this.