4

I am trying to implement new Queueable interface of Winter 15 to allow chaining. But on one of my orgs it gives error as Invalid interface name specified. While same works properly on second org.

Both orgs are on Winter 15. API version is set to 32.0. Link - https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_class_System_Queueable.htm

Any help. Code

public class AsyncExecutionExample implements System.Queueable {
    public void execute(QueueableContext context) {
        Account a = new Account(Name='Acme',Phone='(415) 555-1212');
        insert a;        
    }
}

Thanks, Ray

6

I found out what the issue was. For future reference -

implements Queueable is wrong as Q was capital. tried it with like implements queueable and it works fine.

Weird salesforce.

UPDATE : I contacted SF support and they mentioned this issue is on some specific orgs and they need to set some parameters in the backend for this to execute properly. More Weird

  • Really? I just used Developer Console with public class MyQ implements Queueable { public void execute(QueueableContext context) {} } and it compiles fine – cropredy Nov 13 '14 at 2:11
  • Yes it worked on some orgs with capital Q but not on two new developer orgs that i created. Wasted half a day on this. – Kaushik Ray Nov 13 '14 at 4:27
  • if so, you should file a bug report – cropredy Nov 13 '14 at 17:43
  • They fixed this in Spring'15, you can use Queueable. I found in Winter'15 i would get the occasional internal error when trying to run the job as well. – Andrew Fawcett Feb 7 '15 at 22:56
0

A common problem is a local class in an org (called Queueable in this case) hiding the platform's interface or class. (So the possibility here is that one org has the local class and the other doesn't. I'm assuming you are pushing the same class/inner class to both orgs.)

You can fix this (or eliminate it as the cause of the problem) by qualifying the reference like this System.Queueable.

For example this (contrived example; normally the problem class would be a separate class not an inner class):

public class A {

    public class Queueable {
    }

    public class B implements Queueable {
        public void execute(QueueableContext qc) {
        }
    }
}

fails to compile with:

Error: Compile Error: A.B: Invalid interface: Queueable at line 6 column 31

and can be fixed like this (qualifying the system class):

public class A {

    public class Queueable {
    }

    public class B implements System.Queueable {
        public void execute(QueueableContext qc) {
        }
    }
}

or like this (changing the name of the local class):

public class A {

    public class MyQueueable {
    }

    public class B implements Queueable {
        public void execute(QueueableContext qc) {
        }
    }
}
  • I tried with System.Queueable as well. It didnt work. now I am trying it on outer class level as well but still giving same error. – Kaushik Ray Nov 12 '14 at 14:00
  • Added code as well which i am trying to save. I created a new org and not working on that as well. – Kaushik Ray Nov 12 '14 at 14:01
  • @KaushikRay I just create a top level class that implements Queueable and also an inner class that implements it with no problem with the class set to API 32. So I don;t know what could be causing your problem – Keith C Nov 12 '14 at 14:07
  • Did you try it with the same code that I have added? – Kaushik Ray Nov 12 '14 at 14:08
  • Yes I just tried it and it compiles ok. Can you include the exact compilation error you get? You are saying this one class fails in an entirely empty org? One more thing to try is to re-type the word Queueable by hand; occasionally non-visible characters can get added when cutting and pasting from documentation. – Keith C Nov 12 '14 at 14:18

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.