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

414 views Asked by At

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?
2

There are 2 answers

0
daydreamer On BEST ANSWER

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

0
Kevin London On

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)