According to the Docs for the standard Order Object, PoNumber is a valid field on the object. I have a query that references that field in an Apex class, and the class compiles, and the unit tests pass. All set.

But. Trying to run a few lines of code including that query in the Dev Console's Anonymous Apex window gives the error

No such column 'PoNumber' on entity 'Order'

I then tried running the query in the Console's query tab; same issue. Then I tried inspecting the object definition in the Console (Ctrl-Shift-O, Order.obj); that field isn't listed. But it's list in Setup, and I can reference it from code. Interestingly, I can edit/save the Apex Class containing the query from Dev Console. Here's a simplified version of my query which exhibits this behavior:

select id, OrderNumber, EffectiveDate, PoNumber from Order 

Is this a known issue? Am I overlooking something special about Order.PoNumber?

  • 2
    Did you check FLS?
    – Adrian Larson
    Aug 25, 2016 at 19:21
  • 2
    facepalm. As a wise one man once said, "It's almost always a permissions issue." Didn't think of it because the object should have default perms; I assumed sysadmin would have FLS for all standard fields by default. Either that's not the case or someone has changed the defaults unexpectedly. Please post as answer so I can accept, and thanks! Aug 25, 2016 at 19:27

1 Answer 1


This behavior is most commonly observed when trying to query on a field you do not have read access to via Field Level Security. Navigate to that field in the Setup menu, then click the Set Field-Level Security button. Make sure you have read access.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .