0

I am successfully performing a bulk query operation using simple salesforce to obtain the Id's I want to work with, but when I perform a bulk update like this:

data=[{'Id': '1', 'Date__c': '12/01/2022'},
 {'Id': '2', 'Date__c': '12/02/2022'},
 {'Id': '3', 'Date__c': '12/01/2022'},
 {'Id': '4', 'Date__c': '12/02/2022'},
 {'Id': '5', 'Date__c': '12/01/2022'}]

sf.bulk.Account.update(data, batch_size=200, use_serial=True)

I am getting the following error:

SalesforceMalformedRequest: Malformed request https://[redacted link information]. Response content: {'exceptionCode': 'InvalidBatch', 'exceptionMessage': 'Records not processed'}

when I click on the error link I get the following: InvalidUrl Failed to parse URL. Was expecting 'request' or 'result' but found:result.

I've tried to find documentation on the bulk library but it is very sparse. Any assistance is much appreciated.

8
  • 1
    Likely an issue with the format of the date field: github.com/simple-salesforce/simple-salesforce/issues/366
    – identigral
    Commented Dec 20, 2022 at 20:35
  • I get you're trying to protect some potentially confidential information, but you're not being specific enough. For example, we don't know what endpoint you're hitting, so we don't even know if this is a Bulk 1.0 or Bulk 2.0 request, or what's going on. We need enough information to at least figure out what direction to look in.
    – sfdcfox
    Commented Dec 20, 2022 at 20:36
  • @identigral, that thread was closed without actually solving or determining if the date formatting was an issue. I'm formatting the date as a string so any specific recommendation on the format would be very helpful. Commented Dec 20, 2022 at 20:41
  • @sfdcfox, I'm hitting the Account standard object in salesforce. I'm not entirely sure what information you'd need since all i've hidden is the link to our personalized salesforce. To clarify a point earlier, I successfully completed a bulk account query operation so I suppose I'm using v1? Any pointers on how to see which version of bulk api we're using? Commented Dec 20, 2022 at 20:47
  • @TylerDavis github.com/simple-salesforce/simple-salesforce/issues/…
    – identigral
    Commented Dec 20, 2022 at 20:48

1 Answer 1

1

Not only does the date field need to be a string, it also needs to be formatted in yyyy-mm-dd format, regardless of if you've selected the display settings as mm-dd-yyyy.

convert the date to a string using strftime:

data['date'].dt.strftime('%Y-%m-%d')

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .