How to create a 'Today's date' date property.

@stuartbalcombe thank you so much for this updated solution. So far it’s working great for us. Here’s a screenshot of each of our two workflows in case these are helpful for anyone else.

You could combine those into one: trigger would be known, unknown; then a if-then for yes and no/unknown. Why the 1 minute delay?

@JOpie Re: the 1 minute delay -- We’ve run into issues with our workflows where too many fields are being updated at the exact same moment and Hubspot can’t recognize the “new” data fast enough. In this example, the workflow is first setting the “Today’s Date” field on the contact, then copying that field to other associated objects. Without a delay, Hubspot might not have processed the updated date fast enough and therefore wouldn’t copy any new data over in steps 5-7. So I always add short delays like that into most of our workflows just to err on the side of caution and give Hubspot enough time to process the new data that’s being relied upon for later steps in the workflow.

Yeah, I started with a 1 minute delay in these scenarios. After a long history and a lot of frustration, I’m now defaulting to a 3 minute delay (and that doesn’t even get us to 100%).

Absolutely makes sense. I have a workflow when deals enter our confirmation stage that has a 1 hour delay: that allows the deal owner to finalise that deal stage (we often have very complex deals) without having the workflow immediately triggered and actions taken that the sales manager didn’t want done until all the dots and crosses were taken care of.

@boydjk88 thank you for sharing these screenshots.

Could you share how did you setup the scheduling for this workflows?

Thank you!

I set this up and it works! Thank you!

However, it was driving my entire team crazy because whenever they try to look at what workflow someone had enrolled in the list went on forever since the workflow runs daily.

My solution is a custom code action. Run the custom code action just before you need to use the “today’s date” value in your other workflows.

const hubspot = require('@hubspot/api-client');

exports.main = async (event, callback) => {
 const hubspotClient = new hubspot.Client({
 accessToken: {your access token}
 });

 const today = new Date();
 const isoDate = today.toISOString().split('T')[0];

 try {
 const contactId = event.inputFields.objectId;
 console.log(contactId);

 // Update contact with the "today_s_date" property
 const updateResponse = await hubspotClient.crm.contacts.basicApi.update(
 contactId,
 {
 properties: {
 today_s_date: isoDate
 }
 }
 );
 console.log(`Update response: ${JSON.stringify(updateResponse)}`);

 callback({
 outputFields: {
 contactId: contactId
 }
 });
 } catch (error) {
 console.error(error);
 throw error;
 }
};

Hi @ARich :blush:

Thanks for sharing!

Best,

Diana

@n_costa this version works for Contacts. I’m using it on multiple workflows. This should be easy enough to update the object type to pretty much any of the objects where you need a “today’s date”

Who can clarify how to do this? I swear I’ve tried every solution in here, except for Operations. Is that the only way?
Please help.

I was able to implement @CBader’s workflow for Deals and it is working. I have not tried any of the Contact’s solutions yet.

[Updated from my previous reply] Steal this workflow to dynamically set a Today’s Date property without Ops Hub.
We’ll create 2 properties and 2 workflows to workaround a tricky HubSpot limitation so you can use Today’s date in reporting and calculated properties. Eg. Days until renewal.
:police_car_light: Why are we creating 2 workflows?
To keep our Today’s Date property up to date, we need to run the workflow on the same object at least once a day…
But…
HubSpot now prevents us from enrolling a company in a workflow from within the same workflow.
Here’s how our solution works:
PRE-WORK: Create 2 properties:
→ Today’s Date - Date picker
→ Today’s Date Updated - Single Checkbox
1. Create our first workflow triggered when:
→ Today’s Date Updated is None
→ Today’s Date Updated is Unknown
*Turn on re-enrollment for the trigger
2. Set a delay for a set amount of time
→ This could be anything from 1 minute to 12 hours.
3. Set the property value of “Today’s Date” to the time of the workflow.
4. Set the property value of “Today’s Date Updated” to “YES”.
→ We’ll use this as the trigger in workflow 2.
5. Copy the newly updated “Today’s Date” value to all associated Deals, Tickets, or Quotes.
→ You’ll need to add a corresponding “Today’s Date” property to each object you want to copy to but this way you don’t need additional workflows.
6. Clone your new workflow and make a few tweaks
→ Update the 2nd workflow to be triggered when “Today’s Date Updated” is equal to “Yes”
→ Update step 4 above to set the value of “Today’s Date Updated” to “NO” in the 2nd workflow
And we’re all done. Our property will be updated at the interval we set with the current date in our accounts default timezone.

It’s absolutely insane that Hubspot hasn’t created a default property for that. Not sure how they expect people to upgrade subscriptions if we have to go through all this hassle to get a simple piece information in there.

Created another version for this below - not sure if it will work tomorrow though. I have reenrolment enabled but there are always surprises with this type of workflow

I am not sure why it needs to be so complicated. I found a solution that simply changes the date if it is not known or is over a day old. It would be nice if HubSpot simply fixed the issue by providing an option to select todays date (rolling).

Hi @DLarsen21,

Thanks for sharing how you solved this with a workflow!

Best,

Kristen

@DLarsen21 Thank you. Your solution works perfect.

@DLarsen21 this is a great alternative too. I can see using this in a if/then branch scenario too! Thank you!

I tried all the above solution but every time it seems contacts can’t be re-enrolled.
How did you manage to make it work ?
Here is an example with “today’s date > 1 day ago” but same goes with “today’s date is unknown”

It doesn’t work for contacts. See here.

Oh yeah thanks !