SOQL and Simple Salesforce query

时间:2015-07-28 22:12:54

标签: mysql salesforce soql simple-salesforce

I have a custom object "DisableUserTask__c" with a field "DisableOn__c." I'm at trying to come up with a query to find any "DisableUserTask__c" task with a "DisableOn__c" field that is passed, but I can't seem to come up with a query.

When I run a query just to get a task, the query "DisableOn__c" field comes back with a return in my timezone with the format: u'2015-07-28T21:00:00.000+0000'

I have tried using:

"select Name, Project__c, Ownerid, Id, DisableOn__c, User__c from PIXDisableUserTask__c WHERE Status__c = 'Pending' AND DisableOn__c < :Datetime.now()"

...but that gives me a malformed query. I'm very new to database queries like this so I'm pretty stuck. Any help would be appreciated! :)

2 个答案:

答案 0 :(得分:0)

在查询时,Salesforce会为您提供您正在恢复的格式。您的查询没有问题,您可以直接使用您收到的值进行其他操作。

答案 1 :(得分:0)

我会尝试设置日期变量

DateTime date1 = System.Now();
"select Name, Project__c, Ownerid, Id, DisableOn__c, User__c from PIXDisableUserTask__c WHERE Status__c = 'Pending' AND DisableOn__c < :date1"