0

I have tried the date formats listed in the Salesforce documentation for updating a date datatype field from Mulesoft into Salesforce but they all have been rejected as invalid for datatype. I tried 2019-07-01, 2019-07-01Z, and 2019-07-01-0800. I also tried many of the datetime formats and they were also rejected. What should my dates look like in JSON to correctly update Salesforce Date fields. These fields are NOT datetime fields. This is my input and output json with cleaned data.I am using a multiple row upsert on the account object Input to dw 2 transform

{

"accounts": [

{

  "brokertype": "Agency",

  "name": "XXX XXX Inc",

  "PHP_Broker_ID?": "888888",

  "National_Producer_Number": "8888888",

  "Original_Appointment_Date?": "2017-01-01",

  "Phone?": "5555555555",

}

]

}

Current dw2 output

[

{

"Type": "Company",

"RecordTypeId": "0126A000000ycAiQAI",

"Name": "XXX XXX Inc",

"BillingStreet": "",

"Phone": "5555555555",

"Fax": "",

"Description": "",

"Agency_IDs__c": "888888",

"National_Producer_Number__c": "8888888",

"Original_Appointment_Effective_Date__c": "2017-01-01T00:00:00Z",

}

]

  • 1
    What does your JSON look like and what Salesforce API are you calling - please update your question rather than replying to this comment. – identigral Oct 30 at 16:24
0

The expected format depends if the field (Original_Appointment_Effective_Date__c) is a Date or DateTime type. From the docs for Bulk API (the same format rules apply to standard REST APIs):

Use the yyyy-MM-ddTHH:mm:ss.SSS+/-HHmm or yyyy-MM-ddTHH:mm:ss.SSSZ formats to specify dateTime fields.

Use the yyyy-MM-dd+/-HHmm or yyyy-MM-ddZ formats to specify date fields.

  • yyyy is the four-digit year
  • MM is the two-digit month (01-12)
  • dd is the two-digit day (01-31)
  • 'T' is a separator indicating that time-of-day follows
  • HH is the two-digit hour (00-23)
  • mm is the two-digit minute (00-59)
  • ss is the two-digit seconds (00-59)
  • SSS is the optional three-digit milliseconds (000-999)
  • +/-HHmm is the Zulu (UTC) time zone offset
  • 'Z' is the reference UTC timezone .

If your field is a DateTime, you should be sending "2017-01-01T00:00:00.000Z". If your field is a Date, send "2017-01-01Z"

See this answer for code you can use to test the conversion.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.