You need to sign in to do that
Don't have an account?
rani
Message Edited by rani on 07-11-2008 07:41 AM
Is apex trigger on opportunity based on stage name of opportunity
Hi All,
I have created a trigger on opportunity which sould fire both before insert and before update. Its working fine for all stages of opportunity when the opportunity is edited i.e. before update, but the trigger is not firing when the opportunity is created for few stages and firing for few stages. The trigger is getting fired when an opportunity is created with stage name as first call schedule or proposal and not firing for other stages i.e. lead generated, executive overview or analysis or feebback/demo or closed won or closed lost or stalled.
Help is appreciated.
Regards,
Rani
Message Edited by rani on 07-11-2008 07:41 AM
It should fire for all of them. It is more likely that your code is not doing what it should or that you have used a Try block to catch exceptions but not you are not handling them properly. Either way your code seems to be exiting gracefully without doing what it should.
To test that the code is firing you could try adding a temporary fake error to the trigger at the beginning of your code to see if it is in fact firing or not.
Try Using: trigger.new[0].addError("It Worked!");
As said i've included a error method i.e newOpp[0].addError('Something'); and found that the trigger was getting executed (only when created) when the stage name is first call scheduled or proposal and didnt for all other stages.