You need to sign in to do that
Don't have an account?

SOQL query throwing INVALID FIELD error when run through javascript
Hey,
I am trying to run SOQL query on contact object through Javascript and getting all the updateble fields. But when i try to run the query, the sForce object throws an error that INVALID_FIELD: ↵OtherCountry,OtherLatitude,OtherLongitude,OtherGeocodeAccuracy,MailingStreet↵.
When i run the same query in the query editor, it runs fine and returns all the fields. But it throws error when run through javascript. There is no error in Javascript as i have removed these fields and the query worked fine.
I am trying to run SOQL query on contact object through Javascript and getting all the updateble fields. But when i try to run the query, the sForce object throws an error that INVALID_FIELD: ↵OtherCountry,OtherLatitude,OtherLongitude,OtherGeocodeAccuracy,MailingStreet↵.
When i run the same query in the query editor, it runs fine and returns all the fields. But it throws error when run through javascript. There is no error in Javascript as i have removed these fields and the query worked fine.
Thanks for replying @Sathish balaji.
This is my javascript snippet where i run the query. It is written directly on a VF page. The variable queryfields contains the fields of the object and the object variable holds the object name.
<apex:includeScript value="{!$Resource.Jquery_min}"/>
<apex:includeScript value="/soap/ajax/32.0/connection.js"/>
<apex:includeScript value="/soap/ajax/32.0/apex.js"/>
var query="select "+queryFields+" from "+object+" where id='"+recordID+"'";
sforce.connection.sessionId = "{!$Api.Session_ID}";
var qr = sforce.connection.query(query);
var records = qr.getArray("records");
And i have tried hardcoding the fields. The error persists. It is throwing INVALID FIELD error on the same fields. I don't think there is any issue with the query fields.I have tested both by dynamically accessing the fields as well as hardcoding the fields. Same error is being thrown repeatedly that the fields are invalid. The issue is with the location fields only like geocodeaccuracy, lattitude, longitude etc.