Logo
Home
Resources

Product

Custom Workflow

Resources

Blog
Youtube
Template
Home
>
Product
>
Template Top
>
detail

HubSpot Custom Workflow Guide: How to Find a Contact's "Most Recent Campaign"

When running workflows in HubSpot, you might need to know, "Which marketing campaign did this contact just register for?" This allows you to follow up with the most relevant context.

A 3rd-party custom workflow action makes it possible to dynamically search for a contact's most recent activity.

This article covers the purpose, use cases, and setup steps for the "Recent Campaign Search Action."

‍

Demo Video

Over view
Code

Detail

Purpose of the Action

The primary purpose of this action is to find the single, most recent marketing campaign that the enrolled contact has registered for (typically within the last day or so).

If a contact registers for multiple campaigns in a short period, this action identifies the newest one.

The ultimate goal is to retrieve (output) that specific campaign's details (Campaign ID, Campaign Name, and Campaign Notes), which you can then use in subsequent workflow steps.

Common Use Cases

This action is used to immediately understand a contact's latest interest and automate follow-up.

  • Add Context to Sales TasksA contact submits a generic "Contact Us" form (which triggers the workflow). The workflow runs this action to find the contact's most recent campaign (e.g., "Winter 2025 Sale"). It then creates a task for the sales rep: "Follow up with [Contact Name] (recent campaign interest: [Campaign Name])."
  • Update Contact PropertiesEvery time a contact interacts with a campaign, you can use this action to find the latest one and copy its name to a contact property like "Most Recent Campaign," always keeping it up-to-date.
  • Branching & PersonalizationUse an if/then branch based on the output. If the campaignName found is "Webinar A," send the Webinar A follow-up. If it's "Sale B," send the Sale B follow-up.

Setup Steps

  1. Add the ActionIn the workflow editor, click the "+" icon. Select your installed custom actions (e.g., "Custom Workflow Professional v2") from the left sidebar, and then click "Recent Campaign Search Action."
  2. Save ConfigurationThis action is designed to be simple. It automatically uses the contact enrolled in the workflow, so there are no fields to configure in the setup panel.Simply click the "Save" button in the top left.
  3. Run and Check HistoryWhen a contact meets the trigger criteria and the workflow runs, this action will execute.You can check the "History" tab to see the log.
  4. Review the OutputsIf the action successfully finds a recent campaign for that contact, the "History" log details (right panel) will show the information under "Action outputs":
    • campaignId
    • campaignName
    • campaignNotes

[IMPORTANT] How to Use the Retrieved Information

This action only finds the campaign data. To use it, you must add a follow-up action.

Example: Save the campaign name to a contact property

  1. After the "Recent Campaign Search Action," add a standard HubSpot "Set property value" action.
  2. Choose the contact property you want to update (e.g., "Most Recent Registered Campaign").
  3. In the value field, click the "data source" icon, find the "1. Recent Campaign Search Action" outputs, and select the [campaignName] token.

Now, every time this workflow runs, the contact's property will be automatically updated with the name of their latest campaign interest.

‍

Source Code

HTML
CSS
Javascript

FAQ

Is this "Recent Campaign Search Action" a standard HubSpot feature?

No, it is not. This is a custom action that becomes available by installing a third-party app called "Custom Workflow Professional v2."

There are no settings for this action. Which contact's campaigns is it searching for?

This action automatically references the contact currently enrolled in the workflow (as mentioned in Step 2), so no extra configuration is needed. It identifies and returns the information for the single, most recent campaign that this specific contact was registered for (e.g., from yesterday to the present).

Does this action automatically save the found campaign name (campaignName) to the contact's property (e.g., "Most Recent Campaign")?

No, it does not save automatically. As emphasized in the article's "【Important】How to Use the Retrieved Information" section, this action's only job is to search for and output the campaign information. To save that information to a property, you must add HubSpot's standard "Set property value" action after this custom action and specify the output token (campaignName) as the value to set.

Search

Search more

Related Template

Need Customization?

We can customize this sample to match your specific business requirements.

Book Free Consultation

Got a quick dev request?

Put it on Trello!Need a fix for HubSpot, CMS, or GAS? Post it on Trello.

Development Requests Here

GAS Library: Automated Blog Post NG Word Checking with AI (Gemini/OpenAI)

HubSpot Custom Workflow Guide: How to Find a Contact's "Most Recent Campaign"

HubSpot Custom Workflow Guide: How to "Search" for Products and Get Price/SKU Data

GAS Library Guide: How to Automatically Check for Broken Links in Google Sheets

HubSpot Custom Workflow Guide: How to Auto-Search and Recommend Marketing Events

Company Info
Name : SweetsVillage .Inc
CEO :
‍
Tomoo Motoyama

HomeTemplateCustomWorkflow
Terms & ConditionsPrivacy PolicyContact us

Copyright ©SweetsVillage .Inc

Back To Top Image