You need to sign in to do that
Don't have an account?
jwoodall1
Query dates using remote objects
I am having issues with using the remote objects retrieve method to filter an object using dates. I can't figure out what format the remote objects method wants for the date. It looks like it is using SOQL in the error message and I can get SOQL to work on this field by using the date formatted as 2015-09-23.
start_date__c FROM Coupon__c WHERE Start_Date__c <= '2015-09-23' LIMIT
^
ERROR at Row:1:Column:89
value of filter criterion for field 'Start_Date__c' must be of type date and should not be enclosed in quotes)
It looks like the remote call is putting the single quotes in ('), but I don't have it in my call.
var d = new Date(); d = d.format('yyyy-mm-dd'); coupon.retrieve({where:{Start_Date__c:{lte:d}}}, function(err,c) { console.log(err); });Error: Error occurred while performing RETRIEVE operation on sobject: Coupon__c with data: {where={Start_Date__c={lte=2015-09-23}}} (INVALID_FIELD:
start_date__c FROM Coupon__c WHERE Start_Date__c <= '2015-09-23' LIMIT
^
ERROR at Row:1:Column:89
value of filter criterion for field 'Start_Date__c' must be of type date and should not be enclosed in quotes)
It looks like the remote call is putting the single quotes in ('), but I don't have it in my call.
Daniel Delgado
You have to pass the Date into where clause.