datetime not working in the submit form api

SOLVE
Occasional Contributor

I have referred the developer documentation regarding sending timestamp for hubspot submit form api. I even tried the default 1427997766000 shown in the documentation and it is not working. 

 

Reply
0 Upvotes
1 Accepted solution

Accepted Solutions
Highlighted
HubSpot Moderator

Thanks for that info @edwinbbu , since your field is just a date field, the field must be set to UTC midnight, or the endpoint will not know what to do with that value, and HubSpot will not store the value in the CRM. Further, the V2 Forms API does not do any sort of validation, so you won't get an error if the data isn't sent to HubSpot, we'll just accept anything in that instance. For that reason, the V3 endpoint might be a better option. That said, if you're not seeing an error, would you be able to send the following info:

  1. The full endpoint you're submitting data to.
  2. The raw request request payload you're sending to HubSpot.

I was able to create this simple app that submits to the V2 Forms API a while ago where I've added in a date picker field. This properly submits to HubSpot as a UTC midnight value in milliseconds. Feel free to use it as a guide: https://repl.it/@cbarley10/Forms-V2-endpoint-in-Node-with-a-front-end

 

Here's an example of a contact I just created via that form with the value: http://prntscr.com/o4gx5j

 

5 Replies 5
HubSpot Moderator

Hi @edwinbbu , happy to help! I'll need a bit more info first:

  1. is your field a date field, or a datetime field? If you have a link to that property in your account, that would be great to have. Date fields must be set to UTC midnight which is why I ask.
  2. Any errors you are seeing when submitting the form via API would be awesome to see as well.
  3. Are you using the v2 or v3 (with Ajax Support) endpoint? 
  4. Can you please link a page where your form lives and is being submitted via the API?

Thank you!

Reply
0 Upvotes
Occasional Contributor

Hi @cbarley , 

1. The field type is date picker. ( it is shown in contact property) .

     Here is the link to the contact property

2. I am not seeing any error when submitting the form via api. I am submitting the datetime field(unix format) along with other fields. All other fields are getting updated.

3. I am not sending via ajax endpoint.

4. I am testing the forms via localhost so I am unable to share the link to page which is getting submitted to forms api.

 

Reply
0 Upvotes
Highlighted
HubSpot Moderator

Thanks for that info @edwinbbu , since your field is just a date field, the field must be set to UTC midnight, or the endpoint will not know what to do with that value, and HubSpot will not store the value in the CRM. Further, the V2 Forms API does not do any sort of validation, so you won't get an error if the data isn't sent to HubSpot, we'll just accept anything in that instance. For that reason, the V3 endpoint might be a better option. That said, if you're not seeing an error, would you be able to send the following info:

  1. The full endpoint you're submitting data to.
  2. The raw request request payload you're sending to HubSpot.

I was able to create this simple app that submits to the V2 Forms API a while ago where I've added in a date picker field. This properly submits to HubSpot as a UTC midnight value in milliseconds. Feel free to use it as a guide: https://repl.it/@cbarley10/Forms-V2-endpoint-in-Node-with-a-front-end

 

Here's an example of a contact I just created via that form with the value: http://prntscr.com/o4gx5j

 

Occasional Contributor

Thanks a lot @cbarley  Finally the date type worked after converting to utc midnight format.

HubSpot Moderator

Great to hear @edwinbbu !

Reply
0 Upvotes