Trying to run this very simple operation and getting exception as in title:

list<workorder> o = [select id from workorder];



Generally this type of error occur when there are 2 different type of class has the same same. so the Name is same but signature is different. I am from salesforce apex so I can suggest you to check for your metadata whether there are any 2 same name class/settings/object exist in your system.

  • 1
    WorkOrder is a standard object and @dzh might be having a class with same name (as you have mentioned). But two classes cannot have same name. In such cases, system gets confused and uses the defined class. – Raul Oct 25 '16 at 7:02
  • 2
    He might created a Wrapper class with name 'WorkOrder' ? This often happens. – Pranay Jaiswal Oct 25 '16 at 7:03
  • Ah yes must be it. Hits me twice this month - someone created class test recently and out of the sudden all tests started failing. Lol! – dzh Oct 25 '16 at 7:41
  • For all the System classes, you can maybe append 'System.' to avoid such issues. like. System.Trigger.new instead of Trigger.new – Raul Oct 25 '16 at 7:43

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.