I'm receiving the error INVALID_TYPE_ON_FIELD_IN_RECORD when invoking a custom sobject quick action to create a record and its payload specifies a Date or DateTime field as an input value.

For example, to create an opportunity record and specify its CloseDate.

I'm using the SObject Quick Actions API as documented in the REST API and Actions Developer Guide.

workbench rest explorer

[ {
  "actionName" : "Account.Custom_Create_Oppty",
  "errors" : [ {
    "message" : "Close Date: value not of required type: 2019-11-26",
    "fields" : [ "CloseDate" ]
  } ],
  "isSuccess" : false,
  "outputValues" : null
} ]

I'm very confused because I've tried many variations of ISO8601 date formats with no luck.


Steps to Reproduce

To reproduce the issue, in Setup go to the Account object and create a new action to create a related opportunity (or other object with a date field).

My action simply has the Name and Close Date fields on its layout:

quick action layout

And two predefined field values for the required Stage and Amount fields:

quick action details

From here, create an account record in your org then use Workbench or another tool to invoke the Actions REST API.

workbench rest explorer

  • Have you tried without quotes surrounding the dates? Commented Nov 27, 2019 at 10:54
  • Thanks for the comment. I haven’t tried without quotes around the date, but the data payload is JSON so I don’t think it would be valid as to my knowledge there isn’t a date-type for JSON other than ISO8601 formatted strings. stackoverflow.com/questions/10286204/the-right-json-date-format/…
    – Doug Ayers
    Commented Nov 27, 2019 at 12:46
  • I see, well, maybe worth trying to but most likely you are correct. I also think would be weird if it works. Commented Nov 27, 2019 at 14:21
  • Try 2019-11-29T12:34:56. When I built this tool for Aura (github.com/eltoroit/ETLC_ApexBridge) I passed the dates / date-times as JSON. Send from JS: new date.toJSON(); Receive with Apex: DateTime.valueOf(strDate); I used date-time for both dates and date-times, one reason was that it calculates to GTM in the client and then you do not need to worry about the user's timezone. Commented Nov 29, 2019 at 16:31
  • Thanks for the comment, Andres. I’ve also tried those formats and formats documented at developer.salesforce.com/docs/atlas.en-us.api_asynch.meta/… with no luck. I’m thinking this may be a bug with the API not handling the date strings properly. I’d love to know if other people are seeing same results when they try this.
    – Doug Ayers
    Commented Nov 29, 2019 at 17:23

1 Answer 1


Salesforce Support has logged a bug internally. For reference, the work item is W-6965020.

At the time of posting, I don't believe a "known issue" document has been issued.

You must log in to answer this question.

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