Workflow 'Invalid Property Value' Error with Custom Code Date Output

I’m encountering a persistent issue with a workflow where a custom code action is failing to update a date picker property. The error i receive consistently is “Unable to update property becase property value isn’t valid” I have followed all standard troubleshooting steps and verified the data but the issue persists.

My Setup

I have a workflow with the following actions;

  1. A GET Webhook returns a date string in this format: 2024-09-12T09:50:31.709704+0000
  2. A Custom Code action takes this date string, parses it, and outputs a unix timestamp in milliseconds.
  3. A Copy Property action takes the custom code output and attempts to update a date picker property

My Custom Code:

exports.main = (event, callback) => {
 const date_string = event.inputFields['creation_date'];

 console.log('Raw input from webhook:', date_string);

 if (date_string) {
 const cleaned_date_string = date_string.split('.')[0] + 'Z';
 const date_object = new Date(cleaned_date_string);
 const unix_timestamp_ms = date_object.getTime();

 if (!isNaN(unix_timestamp_ms)) {
 console.log('Final output (milliseconds):', unix_timestamp_ms);
 callback({
 outputFields: {
 formatted_date: unix_timestamp_ms
 }
 });
 } else {
 callback({ outputFields: { formatted_date: null } });
 }
 } else {
 callback({ outputFields: { formatted_date: null } });
 }
};

What I’ve Verified

  • Custom Code Logs: The log confirms the code successfully converts the date string. The output for the given input is 1726134631000.
  • Data Type: The formatted_date output in the custome code action is explicitly set to the Date data type.
  • Property Type: The property I am trying to copy the output to is a Date Picker.
  • Action Configuration: The “Copy Property” action is correctly configured to copy the formatted_date from the custom code to the date picker property.

Despite all the checks, the enrolment history for the “Copy Property” action continues to show the “invalid property value” error.
Is there a specific detail about Hubspot’s date property handling that I am missing?
Any help would be greatly appreciated.

If it’s a Date Picker property that you’re pushing into, have you tried zeroing out the time in the date? I believe that the Date Picker property only accepts timestamps set to 0 hour.

Hi @MichaelMa,

Yeah, I have fixed this now with exactly as you suggested. I have modified the custom code action to set the time component to 0 hour and it works as intended.

OMG Thank you! :folded_hands: