⚙ Operations Hub

rverheijen
Member

Supercharge Your HubSpot Workflows: Generate Short, Unique IDs (Custom Code Action)

SOLVE

Hey Operations Hub community! 👋


We've written a "Custom Code" Action we'd like to share that can help you generate short, unique IDs directly within your HubSpot workflows. This can add a layer of unique identification to your data without needing to get bogged down in complex coding.


Why Use Unique, Short IDs?

Think of these IDs as custom labels for your data. They're perfect for:

  • Keeping Track of Customer Data: Easily identify and manage specific records within your customer data, making analysis more accurate.
  • Streamlining Processes: Create short tracking codes to monitor and track your customer data within your business processes.
  • Connecting HubSpot to Other Tools: If you're syncing data between HubSpot and other apps, these IDs act as a reliable link, ensuring everything stays organized.
  • General data organization: If you have any need for a unique identifier in your workflows, this tool can help.

 

How Does It Work?

We've written a small piece of code that generates 8-character, unique IDs. It's designed to be used directly inside HubSpot's workflow actions, so you don't need to be a coding expert.

 

Here's How to Add It to Your Workflow:

  1. Get the Code: You can find the code here: hubspot_short_uuid_generator
  2. Add a "Custom Code" Action: In your HubSpot workflow, look for the "Custom Code" action and add it.
  3. Copy and Paste: Copy the code from the GitHub link and paste it into the "Custom Code" action.
  4. Tell HubSpot Where to Store the ID: You'll need to tell HubSpot where you want to save the generated ID (e.g., a custom property).
  5. Use the ID in Your Workflow: Now, you can use that unique ID in other steps of your workflow.

 

Example Workflow use case:

We recently faced a situation where we needed to share and sync customer data across multiple applications. To ensure consistent customer identification and the ability to update the data across these systems, we required a reliable, cross-domain ID.

We implemented a workflow that generates a unique 8-character ID whenever a new customer is created in HubSpot. This ID is then pushed to all other applications. This ensures that when a customer interacts with any of the applications, we can easily trace their journey and update their information across all platforms. This solution helped us achieve a unified view of our customer data and streamline our data management.


Why 8 Characters?

8 characters is the sweet spot. It's short enough that you can actually remember it, which is incredibly helpful when you're working with data across different systems. This human-friendly length makes it easier to reference and work with, unlike those long, unwieldy standard UUIDs.

Try It Out!

This code is free to use. Give it a try and let us know how you're using it! We welcome and appreciate all feedback and contributions.

 

1 Accepted solution
rverheijen
Solution
Member

Supercharge Your HubSpot Workflows: Generate Short, Unique IDs (Custom Code Action)

SOLVE

Hi,


The custom code will only output the generated short UUID. Therefore, you'll need to add a second step to your workflow to edit (update) your record. Attached is an example of a workflow that adds the generated short UUID to a newly created company record.


If you're still having trouble, just send me a message.


Ciao,

Remco



Screenshot 2025-05-14 at 11-06-52 Company Generate short UUID HubSpot.png

 

Screenshot 2025-05-14 at 11-07-35 Company Generate short UUID HubSpot.png

View solution in original post

0 Upvotes
7 Replies 7
GHubTech
Participant | Gold Partner
Participant | Gold Partner

Supercharge Your HubSpot Workflows: Generate Short, Unique IDs (Custom Code Action)

SOLVE

Hi @rverheijen ,

Thanks for providing the generate_uuid.py script. I’ve implemented it as a custom code action in a HubSpot workflow, and it executes successfully. I also made sure to define short_uuid in the Data Outputs panel with a String type, as instructed.

However, after the code runs, I’m unable to access the short_uuid output in subsequent workflow steps (e.g., when trying to copy it into a contact or deal property). It doesn’t appear in the list of available outputs, even though the code runs without errors.

I also tried hardcoding the output value to ensure the issue wasn’t with the UUID generation, but the behavior persists.

Could you please help verify if the structure of the callback({"outputs": {"short_uuid": short_uuid}}) response is compatible with the current HubSpot environment, or if any adjustments are needed to make the output accessible in other steps?

Appreciate your help on this.

0 Upvotes
rverheijen
Solution
Member

Supercharge Your HubSpot Workflows: Generate Short, Unique IDs (Custom Code Action)

SOLVE

Hi,


The custom code will only output the generated short UUID. Therefore, you'll need to add a second step to your workflow to edit (update) your record. Attached is an example of a workflow that adds the generated short UUID to a newly created company record.


If you're still having trouble, just send me a message.


Ciao,

Remco



Screenshot 2025-05-14 at 11-06-52 Company Generate short UUID HubSpot.png

 

Screenshot 2025-05-14 at 11-07-35 Company Generate short UUID HubSpot.png

0 Upvotes
rverheijen
Member

Supercharge Your HubSpot Workflows: Generate Short, Unique IDs (Custom Code Action)

SOLVE

And the short_uuid in the 'Choose a value' field could be found under 'Action outputs', 'Custom code'.

rverheijen_0-1747223987732.png

 

0 Upvotes
GHubTech
Participant | Gold Partner
Participant | Gold Partner

Supercharge Your HubSpot Workflows: Generate Short, Unique IDs (Custom Code Action)

SOLVE

Hi,

I have messaged you with the variables and screenshot of my implementation. Kindly see. Thanks!

0 Upvotes
rverheijen
Member

Supercharge Your HubSpot Workflows: Generate Short, Unique IDs (Custom Code Action)

SOLVE

Replied 😉

0 Upvotes
kennedyp
Community Manager
Community Manager

Supercharge Your HubSpot Workflows: Generate Short, Unique IDs (Custom Code Action)

SOLVE

Hi @rverheijen! Welcome to the Community-- happy to have you here 😊 Thank you so much for sharing this code! I am sure so many HubSpot customers will find value here! 

Hey @Ktamir, @louischausse, @johnelmer, @Teun -- wanted to bring this to your attention in case you may find it useful down the road! 


HubSpot’s AI-powered customer agent resolves up to 50% of customer queries instantly, with some customers reaching up to 90% resolution rates.
Learn More.


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !
0 Upvotes
Ktamir
Contributor | Platinum Partner
Contributor | Platinum Partner

Supercharge Your HubSpot Workflows: Generate Short, Unique IDs (Custom Code Action)

SOLVE

Thank you for sharing this with me 



<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">










Karin Tamir










Karin Tamir

HubSpot Expert
Glare Marketing Technologies | HubSpot Platinum Partner



Schedule a Call with me










Thumbs Up

Did my post help answer your query? Help the community by marking it as a solution.