I create a trigger on User that only insert/update other table when there are changes/insertions into the Department field that belong to User. It’s working fine except sometimes I receive this exception in my email:
Apex script unhandled trigger exception by user/organization:
0053000000xxx/00DQ0000003Lxxx Source organization: 00D00000000hxxx
(null) MyUpdateTrigger: execution of BeforeUpdate
caused by: line 55, column 24: Dependent class is invalid and needs
recompilation: MyHelperClass: line 28, column 30: No such column
‘Department’ on entity ‘User’. If you are attempting to use a custom
field, be sure to append the ‘__c’ after the custom field name. Please
reference your WSDL or the describe call for the appropriate names.
I check the line number: it points to empty line.
The Department api name has no __c at the end.
I don’t receive an email on this error when I do a manual test. I just received an email occassionally, meaning someone is firing the trigger.
Any ideas about the meaning of that error? How to troubleshoot this type of error?
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Here’s a second tip on dealing with this error.
Let’s say you are manipulating the signatures in the Force.com Enterprise Architecture Service layer. There are three files involved:
If you are refactoring a method signature, it is common to get this error since these three classes are inter-related. You probably already know what you are trying to do but can’t figure out which class to change in which order. Each ‘approach path’ you take ends up with the
dependent class needs to be compiled error
The solution (for example, in your IDE) is to touch each class but not save. That is, the file’s tab in the IDE has an asterisk indicating unsaved. Then, use
File | Save All so SFDC compiles all the classes together and avoids the dependent class compilation issue.
If you get a new compilation error indicating some syntax error, touch all classes again and repeat
File | Save All.
Here’s an extra tip in diagnosing the Error:
Dependent class is in error and needs recompilation
It is possible that if you get this error in the Force.com Eclipse IDE, there will be no further diagnostic information beyond the line number of the class being compiled that references some dependent class (which could be the dependent of a dependent …).
You’re left puzzling over where the problem could be.
Copy-paste your code from Eclipse IDE into the Developer Console file for the same class and click Save. The Developer Console will report the full error message with a direct pointer to the underlying class that is in error
UPDATE for Eclipse: Turns out if you hover over the error line in
Eclipse (tested in V38 Force.com IDE), the full detailed explanation as to which class is at issue
will appear. You don’t need to go to the Developer Console.
Here’s an example:
From Eclipse IDE
Dependent class is in error and needs recompilation Line 14
From Developer Console
Dependent class is in error and needs recompilation Line 14, Class Foo line 56 method has incorrect signature (..)
where Foo is the dependent class in error and line 56 tells you why it is in error.
As per error message, it looks like there is a class named “MyHelperClass” in your code base. Just open the class and try to save it. If it gives error, resolve the error and it should resolve this issue.
I found out the issue happen because the trigger is fired by User who does not have accessibility to Department field.That’s is why it said it did not ‘No such colum bla bla’ and that ‘ s why I cannot simulate the issue because I have the accessibility to the field.
Although old thread but thought it might help. I had same issue and searched thru many sites & finally got simple answer posted in salesfore site. Just use Compile all from Apex Class & Trigger under setup. This resolved my issue.
If during deployment, you get the ‘Dependent class is invalid and needs recompilation’ error, it means that the classes and triggers need to be compiled in your Organization.
1. To compile Classes:
- Go to Setup | Develop | Apex Classes
- Click ‘Compile all classes’ Link
2. To compile Triggers:
- Go to Setup | Develop | Apex Triggers
- Click ‘Compile all triggers’ Link