简体   繁体   English

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

[英]python salesforce beatbox: beatbox._beatbox.SoapFaultError: 'INVALID_FIELD'

I am using beatbox to connect to Salesforce from Python and it works fine until I try to add constraint with dates. 我正在使用beatbox从Python连接到Salesforce,在我尝试添加日期约束之前,它工作正常。

When I add a CreatedDate constraint it fails saying 当我添加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"
  • How can I send a datetype object to query and fix this? 如何发送datetype对象以查询和解决此问题?

Just realized, it needs date in format that SFDC way - 2012-08-15T00:00:00+00:00 刚意识到,它需要以SFDC方式格式的日期-2012-08-15T00 2012-08-15T00:00:00+00:00

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

This will give you a datetime object: 这将为您提供一个datetime对象:

import datetime

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

date = return_datetime(2012, 8, 12)

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

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