Skip to content. | Skip to navigation

Personal tools
Log in
Sections
You are here: Home Database Salesforce Apex & Visualforce Spontaneous Invalidation of Classes and Triggers

Spontaneous Invalidation of Classes and Triggers

My triggers and classes are active but invalid, what the heck does THAT mean?

What is means is that your code needs to be recompiled. This can be done for classes by re-running the tests in the product environment (and passing them!)

 

For triggers, one might assume that running tests would also cause them to become valid as it SHOULD cause a recompile of the trigger. However, this is not the case. Instead, you'll need to manually trigger the trigger by firing the even the trigger is on. For example, a 'Before Insert' on 'Opportunity' could be revalidated by simply creating a new opportunity and then deleting that opportunity. When the new opportunity is created, this will fire the 'Before Insert' event, causing a trigger recompilation and validation.  But again, this will not work with test methods, creating an opportunity in a test will cause the trigger to fire and recompile, but not to validate.

 

 

Document Actions

Comments (0)

« February 2012 »
February
MoTuWeThFrSaSu
12345
6789101112
13141516171819
20212223242526
272829