Skip to main content
1 of 4
abdn
  • 535
  • 7
  • 21

BillingAddress in Query generate error

I have a query like below in an Apex Class in Sandbox.

query = 'SELECT Id, Name, BillingAddress, BillingLatitude, BillingLongitude FROM Account WHERE Name = \''+ name +'\' AND '; query += 'DISTANCE(BillingAddress, GEOLOCATION('+lat+', '+lng+'), \'km\') < '+distance+' ORDER BY DISTANCE(BillingAddress, GEOLOCATION('+lat+', '+lng+'), \'km\') ASC';

It works perfect in sandbox. But when I try to deploy this class to live it generate this error:

System.QueryException: No such column 'BillingAddress' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

What are the possible reasons?

abdn
  • 535
  • 7
  • 21