You may have noticed that, when using CRM mapping to push a date into HubSpot, that the format is not exactly what you hoped for. The date defaults to using "single-line text" field type, instead of a true "date" field type. Read on to learn how to change this in our 2-step tutorial.
Note: If you'd like to learn about date formatting with Liquid filters, check out this article.
Step 1: Create a new CRM mapping property
First, go to the CRM Settings page and scroll down to the Set up CRM field mapping section at the bottom. Click Configure. In the modal that opens, click Add new field, and then type in a name for your new property (we've gone with "Paycove Due Date"). In our example, we use the built-in "deal.invoice_due_date" property, but we've made it more specific by adding date filters (which make specific dates pull in). Copy and paste the following into the "Property data" field:
{% if deal.invoice_due_date %}{{deal.invoice_due_date | date: "%Y-%m-%d" | date: "%s000"}}{% endif %}
Click Save changes in the modal, and then again on the bottom right of the page. The new variable should be pushed to HubSpot.
Advanced: Variable Breakdown
Here is how the variable and filters were chosen:
- We began with the
deal.invoice_due_date
property. - We then added two date filters for HubSpot to recognize it:
| date: "%Y-%m-%d" | date: "%s000"
- So far:
{{deal.invoice_due_date | date: "%Y-%m-%d" | date: "%s000"}}
- So far:
- Finally, we wrapped it in an if statement to make sure the date exists in the first place:
- We added
{%raw%}{% if deal.invoice_due_date %}
at the start and{% endif %}
at the end. - Final:
{% if deal.invoice_due_date %}{{deal.invoice_due_date | date: "%Y-%m-%d" | date: "%s000"}}{% endif %}
- We added
Step 2: Change the field type in HubSpot from "single-line" to "date"
Next, you will edit the field type in HubSpot from single-line text to date. (Note that you'll want to make this change right away. If any values get sent from Paycove to HubSpot, you'll no longer be able to edit the field type on them.) You may need to resync in HubSpot to have the new variable show up.
To change the field type, locate the property and click Edit Property.
Then in Edit mode, in the Field type section, choose Date picker from the dropdown menu. Adjust other settings at this time if needed, and be sure to Save when you're done.
Finally, check the variable on your desired deal, and you should see the due date in a true date type format.
If you need further assistance with this, feel free to reach out to us at support@paycove.io, and we'd be glad to help!