python salesforce beatbox:beatbox._beatbox.SoapFaultError:'INVALID_FIELD'

时间:2012-08-16 18:57:05

标签: python salesforce beatbox

我正在使用beatbox从Python连接到Salesforce,它可以正常工作,直到我尝试添加带日期的约束。

当我添加CreatedDate约束时,它无法说

File "/Library/Python/2.7/site-packages/beatbox/_beatbox.py", line 332, in post
    raise SoapFaultError(faultCode, faultString)
beatbox._beatbox.SoapFaultError: 'INVALID_FIELD' "INVALID_FIELD: from Assets__c where CreatedDate > 2012-08-08 ^ ERROR at Row:1:Column:1061 value of filter criterion for field 'CreatedDate' must be of type dateTime and should not be enclosed in quotes"
  • 如何发送datetype对象进行查询和修复?

2 个答案:

答案 0 :(得分:1)

刚才意识到,它需要采用SFDC格式的日期 - 2012-08-15T00:00:00+00:00

参考 - http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_select_dateformats.htm

答案 1 :(得分:0)

这将为您提供日期时间对象:

import datetime

def return_datetime(year, month, day):
    return datetime.datetime(year, month, day)

date = return_datetime(2012, 8, 12)