python salesforce beatbox: beatbox._beatbox.SoapFaultError: 'INVALID_FIELD'
-
26-06-2021 - |
题
I am using beatbox to connect to Salesforce from Python and it works fine until I try to add constraint with dates.
When I add a CreatedDate constraint it fails saying
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?
解决方案
Just realized, it needs date in format that SFDC way - 2012-08-15T00:00:00+00:00
reference - http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_select_dateformats.htm
其他提示
This will give you a datetime object:
import datetime
def return_datetime(year, month, day):
return datetime.datetime(year, month, day)
date = return_datetime(2012, 8, 12)
不隶属于 StackOverflow