简体   繁体   English

SOQL和简单Salesforce查询

[英]SOQL and Simple Salesforce query

I have a custom object "DisableUserTask__c" with a field "DisableOn__c." 我有一个带有字段“ DisableOn__c”的自定义对象“ DisableUserTask__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. 我正在尝试提出一个查询,以找到传递了“ DisableOn__c”字段的任何“ DisableUserTask__c”任务,但我似乎无法提出一个查询。

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' 当我运行查询以获取任务时,查询“ DisableOn__c”字段返回时区,其格式为: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! 任何帮助,将不胜感激! :) :)

On querying, Salesforce give you the format you are reciving. 查询时,Salesforce为您提供要接收的格式。 There is no problem with your query and you can directly use the value you recieved for other operations. 您的查询没有问题,您可以直接将收到的值用于其他操作。

I would try setting a date variable 我会尝试设置一个日期变量

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"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM