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

Trigger not firing in Dev account
I created a custom object that i would like to trigger the creation of a Case when the object is created or updated with an open status. I found a previously writen trigger that I am using:
trigger CreateCase on PE_Case__c(After Update)
{
if(Trigger.isUpdate){
for(PE_Case__c p: Trigger.new)
{
if(p.Status__c == 'Open')
{
Case cs = new Case();
cs.Reason = 'Internal';
insert c;
}
}
}
}
Saleforce is accepting the trigger with no errors, but it is not firing.
Any help would be appreciated.
Since you mentioned that you would like the trigger to act upon insert and upon update.
I've optimized the code for bulk processing. Please check the following code:
Hope it helps!
All Answers
The trigger is for After Update only, so creation of a new PE_Case__c record won't fire the trigger.
Also, make sure your trigger is set to be both Active and Valid under the trigger menu (Setup->Develop->Apex Triggers) A trigger is set to valid once the code fires, if it isn't already.
The trigger is showing a status of Active and has a check mark for Is Valid.
Understanding it will not create a ticket at creation, I had temp changed to try to make it work at least for an After Update. I even tried Before Update to see if that would work, but it is still not firing..
Thank you for the feedback... assistance is very much appreciated.
Kraftti1,
Just check the insert statement. You are declaring the case variable as cs, but while inserting you are issuing insert c.
change it to insert cs and it should work.
Aslo do use system.debug, for the checking if the control is being passed to the trigger or not and make best utilization of the debug logs.
Hope it helps
Since you mentioned that you would like the trigger to act upon insert and upon update.
I've optimized the code for bulk processing. Please check the following code:
Hope it helps!
Thanks to all for the help...
Xhitman - Your the man...