You need to sign in to do that
Don't have an account?
Query returns nothing using javascript forcetk, but return something in workbench
Hello everybody,
I have a simple query :
SELECT Id, Name, D_signation_article__c, Emplacement__c FROM Article__c WHERE Emplacement__c INCLUDES ('Intérieur')
For information, Emplacement__c is a pickList field in Salesforce.
This query return nothing in my hybrid mobile application (zero records), using Phonegap (also called Cordova) and the javascript libary forcetk (which uses REST API).
I call this query like this in my javascript program :
var customQuery = "SELECT Id, Name, D_signation_article__c, Emplacement__c FROM Article__c WHERE Emplacement__c IN ('" + emplacementOr + "')"; logToConsole('+++ query: ' + customQuery); forcetkClient.query(customQuery, onSuccessSfdcArticles, onErrorSfdcArticles); });
Of course, the variable emplacementOr contains the appropriate value 'intérieur' (like the first query above).
Like I said, this javascript code return nothing in my mobile app. But I'm sure this query is valid and returns actually something. I tested this exact same query in the Workbench tool, and I actually have one record that is returned. Besides, I know for sure there is a record matching.
Anyone hase an explanation for this ? Anyone already got a similar problem ? It's been days I'm trying to get it work withoud success.
Thanks for advance for any help.
Probelm solved,
I changed a setting in the file forcetk.mobilesdk.js, in the definition of the function forcetk.Client.prototype.query. I changed the encoding method from "escape" to " encodeURIComponent". So it was simply a matter of encoding the accents.