+ Start a Discussion
dn6184dn6184 

Triggers Not Firing From UI

Hi, 

 

We just discovered that our triggers are not firing at all when inserts or updates are originated from Salesforce pages.  There are no validation errors and the upde / insert operations go through as usual, just no triggers fire.  We have place system.debug statements in the trigger code at the first line and monitored the logs.  We tested the triggers using apex test classes and they fire fine in that scenerio.  Does anyone have any ideas?

 

Thanks, Dave

Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox

Your debug log levels might be set to not show you enough details (e.g. you don't see them fire in the logs). Assuming they are active, they are indeed firing. The only time triggers will not fire is under the same conditions where a workflow won't fire (such as super-mass edits, such as replacing picklist values).

 

Check your debug logs, or turn on debug monitoring for a user and test as that user. Also, if you haven't already, write your test methods with some asserts to prove that the code is running. If your asserts fail, then you can diagnose where the problem lies. You can also prove your triggers are firing or not simply by adding a single line at the top of your trigger (at line 2 of your code):

 

system.assert(false);

Note that this will cause all DML operations that the trigger fires for will automatically fail, so be prepared to roll back the code, and let your users know of the downtime. Or just make your changes in a Sandbox or Developer Edition (you do have one of those, right?).

 

Maybe just with the debug log levels altered, you'll figure out where the glitch lies.

All Answers

asish1989asish1989

HI

   may be your trigger is in inactive state. 

   please make sure that is Active check box is clicked on trigger page .

   is Active check box is present just above of your trigger code when you open your trigger code in edit mode.

 

 

 

 

Did this post answer your problem ..if so please mark it solved for reference.

 

Thanks

asish

dn6184dn6184

All triggers show Status = Active

sfdcfoxsfdcfox

Your debug log levels might be set to not show you enough details (e.g. you don't see them fire in the logs). Assuming they are active, they are indeed firing. The only time triggers will not fire is under the same conditions where a workflow won't fire (such as super-mass edits, such as replacing picklist values).

 

Check your debug logs, or turn on debug monitoring for a user and test as that user. Also, if you haven't already, write your test methods with some asserts to prove that the code is running. If your asserts fail, then you can diagnose where the problem lies. You can also prove your triggers are firing or not simply by adding a single line at the top of your trigger (at line 2 of your code):

 

system.assert(false);

Note that this will cause all DML operations that the trigger fires for will automatically fail, so be prepared to roll back the code, and let your users know of the downtime. Or just make your changes in a Sandbox or Developer Edition (you do have one of those, right?).

 

Maybe just with the debug log levels altered, you'll figure out where the glitch lies.

This was selected as the best answer