function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Riadh MRiadh M 

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.

Best Answer chosen by Admin (Salesforce Developers) 
Riadh MRiadh M

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.