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
JDevJDev 

AJAX mergefield syntax problem

I'm trying to use a merge field from a custom picklist in a where clause - my merge field value is "Mountain"
 
The following query runs successfully in Eclipse:
Select r.Region_Unit_ID__c, r.Name, r.Active__c From Region__c r where r.Name = 'Mountain' limit 1
 
However the following AJAX query returns error TypeError: records has no properties (if the where clause is passed a value - there is no problem if the value is null)
 
"Select r.Region_Unit_ID__c, r.Name, r.Active__c From Region__c r where r.Name = 'Mountain' limit 1", callback ); 
 
I've tried defining a variable and substituting the value but no luck - any ideas?
 var thisWhere = "Mountain";

"Select r.Region_Unit_ID__c, r.Name, r.Active__c From Region__c r where r.Name = '" + thisWhere + "' limit 1", callback );

If I send null string I'm successful (but result is obviously unhelpful)

"Select r.Region_Unit_ID__c, r.Name, r.Active__c From Region__c r where r.Name = '' limit 1", callback );

JDevJDev
Never mind - issue was related to result processing downstream variable syntax is fine