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

Dependent class is invalid and needs recompilation when using design pattern
I have a interface Z with two methods, Class A and class B implements that interface Z,
I have one more class C which instantiates objects of class A and class B
Also, in class A and B there is a future callout respectively
Now in trigger T, I create an object of class C and an instance of interface Z. where it calls a method of class C and also pass instance of interface Z as a parameter of that method.
Now when compiling all of them together, i get 'Dependent class is invalid and needs recompilation'. so in outbound change set,
I have to explicitly sequence them and deploy accordingly.
Like say, I created 4 outbound change set, one for Z, other for A and B, another for C and another for Z, to avoid the above error
Is this the correct approach.
Is it that the dependant files need to go in different outbound change set, so that they can be compiled separately, and there is no dependency issue.
In the sandbox environment, the code works as expected.
This shouldn't be the case, when your deployment contains all dependencies, it should deploy ok, in my experience anyway.
i would try to deploy the classes & trigger via eclipse and verify the results.
Are you deploying to Production? Or just another sandbox. If you are deploying to an environment on which code can be modified, then possibly the code is already uncompilable on the destination environment.
In Eclipse, i made a copy of all the files[renamed] , and when i compile interface Z, class A ,B,C and the trigger T together , i see error for trigger
Multiple markers at this line
- File only saved locally, not to server
- Save error: Invalid type:
InterfaceName
also, i dont see the files being added in the salesforce sandbox environment except for interface file.
i rechecked by copying the contents to new files again, and compiled Z,A,B,C, i did not see any compile error in Eclipse, but when i recheck from salesforce sandbox environment, all the files were not there [file B was not there], I had to go back to Eclipse, add a space or something to the not added file, and build again, then i saw it in the salesforce sandbox environment.
hence when deploying we were getting the 'Dependent class is invalid and needs recompilation when using design pattern' error,
and had to segregate the outbound change set, preferably in two set, [Z, A, B] and [C, T]
I just had this error while doing production move and my breath stopped.
But I also had few more custom field related issues along with this error.
Just to try my luck, I resolved the field related issues and tried to run the deployment again.
And I noticed that this error was gone.
So, due to field issues, a class was not getting deployed and due to that all the classes dependent on it were not getting deployed.
Hope this helps.