1

I have a class that I updated and am pushing to production.

When I validate, I am getting this error for all 300 classes in production:

line -1, column -1: Dependent class is invalid and needs recompilation: Class CommunitiesSelfRegController : Method does not exist or incorrect signature: void automatedClass(List) from the type AutomatedCreditStart

The class I am updating is AutomatedCreditStart.cls and the method I updated is automatedClass(List<Id>). I updated the name of the class and some of the logic within the class, but did not change the parameters or list datatype.

--> currently in production:

public class AutomatedCreditStart {
    @InvocableMethod
    public static void automatedClass(List<Id> oppStatementsIn) {

--> updates trying to push to production:

public class AutomatedCreditStart {
    @InvocableMethod
    public static void createCreditReviews(List<Id> oppStatementsIn) {

The test class that belongs to AutomatedCreditStart.cls has passing coverage.

AutomatedCreditStart.cls is on version 41 in production and the newly updated class is also on v41.

The method does exist, the signature is correct, is this actually a recompilation issue? Do I actually need to recompile all of my classes? I do not want to do this as some of the classes will break if I update them. I can't figure out what the actual issue is. I doubt it is a recompile issue because I am not changing versions.

2
  • 2
    So you changed the method name? Did you leave the old method name in? Did you update all references to this method? – Adrian Larson May 2 '18 at 16:54
  • I did change the method name and took out the old method name. I updated all references except for one instance in a test class. This is where the issue was, thank you for prompting thought on this, I just pushed with the appropriate updates and it passed validation – Olivia May 2 '18 at 19:05
3

If you want to change the method name, you have two choices:

  1. Replace the old method name with the new one. If you do so, you need to update every class which makes use of this method to replace the name there as well.
  2. Leverage method overloading to simplify the cut over. In this way, you can start the move to your new method name without making it all or none.

    public static void myNewMethod(List<Id> param)
    {
        // do stuff
    }
    public static void myDeprecatedMethod(List<Id> param)
    {
        myNewMethod(param);
    }
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.