Skip to content
Tutorials Center
My learning

Topics

Lesson 25 of 37 Β· Automation and Workflows

Workflow Branches, Delays and Data Hygiene

Go deeper into HubSpot workflows: if/then branches, delays, goals, webhook and custom-code actions, error handling and testing, with runnable branching and delay simulations.

A straight line of actions only gets you so far. Real processes depend on what happened since the record was enrolled: did the contact open the email, did the deal move, is the owner on holiday? Branches and delays let a workflow wait and decide, which is where automation becomes useful and, if careless, noisy.

HubSpot cannot run here. The Python blocks are labelled stand-ins that model timing and decisions; the HubSpot editor is a visual canvas with the same building blocks.

If/then branches

An If/then branch evaluates conditions on the record and sends it down one of several paths. Types:

  • Based on filter criteria: for example "Number of employees is greater than 200". The first branch whose conditions match wins; everyone else goes to None met.
  • Based on the contact's engagement: opened an email, clicked, replied.
  • Value equals (a "Value equals" branch lets you map a property's values to outcomes, for instance country code to regional owner).

Branches can be nested, but deep trees are hard to maintain. If you have more than three or four paths, consider a single "set property" step to classify first, then branch once.

Delays

A Delay pauses a record. Options are:

  • a set amount of time (two days),
  • until a day of the week or time of day (wait until Tuesday 10:00),
  • until a date property (wait until the renewal date minus seven days, using the option to delay relative to the date).

Delays are how you build nurture streams and reminders without sending everything at once. They also create a hidden risk: during a delay, the record's facts can change, so re-check the condition after waiting.

Wait, then decide

Send email Step 1
Delay 3 days Give them time
If opened? Branch on engagement
Yes: task. No: resend Different paths

Always re-check after a delay

1 / 2

Simulating a nurture flow

The stand-in below plays a record through "send, wait three days, branch on whether it opened". It uses a fake clock so the output is deterministic.

Python Delay then branch (stand-in)

Press Run (or Ctrl + Enter) to see the result here.

Program input Β· what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Wait until a specific weekday and time

A "send on Tuesday at 10:00" delay is common because emails sent at a planned time perform more predictably. The calculation below shows what the next valid time is.

Python Delay until the next Tuesday 10:00

Press Run (or Ctrl + Enter) to see the result here.

Program input Β· what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Goals

A goal is an exit condition checked while the record is in the workflow, for example "Contact has a meeting booked." As soon as it is true, the record leaves the workflow (and you can choose to run a follow-up). It prevents the classic mistake of sending a "Have you booked a call?" email to someone who booked yesterday.

Developer actions

  • Trigger a webhook (Professional and above): HubSpot sends a POST with the record's properties to a URL you own. Use it to notify your own systems; see webhooks and rate limits.
  • Custom code (Operations Hub Professional): run short Node.js or Python code inside the workflow, with outputs usable in later steps. Keep secrets in the workflow's secret store, not in code.
  • Format data actions clean text, change case, trim spaces, and do date math.

Testing and monitoring

  • Use Test with a sample record before you turn the workflow on.
  • In the workflow's History you can see which records enrolled, what each action did, and failures.
  • Set up workflow error alerts so action failures (for instance an unreachable webhook) reach someone.
  • Use Go to action carefully; loops can send repeated emails.

Common mistakes

  • Sending several emails to one contact from different workflows: create a suppression or global send frequency rule.
  • Branching on a property that is set later in the same workflow.
  • Forgetting time zones: delays use the portal's time zone unless set otherwise.
  • Turning on re-enrollment for a record type that changes constantly.

Check your understanding

Quick check Β· 3 questions

of 3 answered You scored / 3 Β· perfect!

  1. 1. What happens to a record that matches no if/then branch?

    Each if/then step has a None met path for records that match no branch.
  2. 2. Why re-check a condition after a delay?

    A property can change during a delay, so branch afterwards instead of assuming.
  3. 3. What does a workflow goal do?

    Goals exit records that already achieved the outcome so they receive no unnecessary steps.

Summary

  • Branches route records by their data; delays let time pass before the next step.
  • Re-check conditions after delays and use goals to exit early.
  • Webhook, custom code and format-data actions extend workflows.
  • Test, monitor history and watch for overlapping workflows.

Next: Lead Scoring and Lifecycle Automation