+ Start a Discussion
AlexPHPAlexPHP 

Why is a trigger not "Is Valid"?

I can't seem to find documentation explaining why a trigger does not have the "Is Valid" flag checked on the Setup interface.

 

Can somebody shed some light on this or reference me to a resource explaining this?

 

Much appreciated. 

Best Answer chosen by Admin (Salesforce Developers) 
CaptainObviousCaptainObvious
I've seen this happen from time to time- In Salesforce, Edit the trigger and click Save (you dont even have to modify the contents).

All Answers

CaptainObviousCaptainObvious
I've seen this happen from time to time- In Salesforce, Edit the trigger and click Save (you dont even have to modify the contents).
This was selected as the best answer
AlexPHPAlexPHP

Ah, that indeed seems to do the trick.  I wonder what the repercussions, if any, there are with leaving it as "invalid".

 

In either case, thanks for the tip! 

jeffdonthemic2jeffdonthemic2

I asked one of the PMs this same question a month or so ago. Here is his response:

 

"So it may sound strange, but you don’t need to care if the class is invalid or valid.  We’ve been meaning to remove that field from the UI.  It’s really an internal detail of salesforce.  The class for your purposes is valid so long as it compiles." 

 

HTH

 

Jeff Douglas
Appirio, Inc.
http://blog.jeffdouglas.com 

bob_buzzardbob_buzzard

It's actually documented in the apex developer's guide, but you have to search for "isvalid" as opposed to "is valid" - took me some time to figure that out!

 

--- snip --- 

 

Note: Triggers are stored with an isValid flag that is set to true as long as dependent metadata has not changed

since the trigger was last compiled. If any changes are made to object names or fields that are used in the trigger,

including superficial changes such as edits to an object or field description, the isValid flag is set to false until the

Apex compiler reprocesses the code. Recompiling occurs when the trigger is next executed, or when a user re-saves

the trigger in metadata. 

 

 

--- snip --- 

phantom1982phantom1982

One important thing I noted was it is must for a Scheduled class to have IS VALID ticked.