2

I am trying to get the list of last 10 accounts viewed. The code seems to be working in sandbox and workbench but when I try deploying it in production, I get the error: No such column 'LastViewedDate' on entity 'Account'.

SELECT Id, Name, LastModifiedDate 
                           FROM account 
                           WHERE LastModifiedDate !=null ORDER BY LastViewedDate DESC limit 10

<apiVersion>31.0</apiVersion>

Attached the error messagsThe error message

0

This appears to be a known issue. See When performing several SOQL queries from different Apex classes, "No such column 'LastViewedDate' on entity " is thrown.

You mention that you are using API version 31.0, which should be sufficient. Are there other apex classes involved in the test that have an earlier API version?

  • No Its only one class, but I fixed it this way – Metawaa Oct 5 '15 at 21:49
  • SELECT Id, Name, LastModifiedDate FROM account WHERE LastModifiedDate !=null ORDER BY LastModifiedDate DESC limit 10 – Metawaa Oct 5 '15 at 21:50
  • LastModified instead of view... – Metawaa Oct 5 '15 at 21:50

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