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

**URL:** <https://community.hubspot.com/t/supercharge-your-hubspot-workflows-generate-short-unique-ids-custom-code-action/129092>\
**Category:** Data Hub\
**Created:** [April 2, 2025, 8:09am UTC](https://community.hubspot.com/t/supercharge-your-hubspot-workflows-generate-short-unique-ids-custom-code-action/129092 "2025-04-02T08:09:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![rverheijen](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/rverheijen/32/37160_2.png) [@rverheijen](https://community.hubspot.com/u/rverheijen)\
**Post date:** [April 2, 2025, 8:09am UTC](https://community.hubspot.com/t/supercharge-your-hubspot-workflows-generate-short-unique-ids-custom-code-action/129092/1 "2025-04-02T08:09:52Z")

</div>

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](https://github.com/x-equipment/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.

---

<div class="post-metadata">

**Author:** ![kennedyp](https://avatars.discourse-cdn.com/v4/letter/k/49beb7/32.png) [@kennedyp](https://community.hubspot.com/u/kennedyp)\
**Post date:** [April 2, 2025, 3:48pm UTC](https://community.hubspot.com/t/supercharge-your-hubspot-workflows-generate-short-unique-ids-custom-code-action/129092/2 "2025-04-02T15:48:38Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Ktamir](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/ktamir/32/83497_2.png) [@Ktamir](https://community.hubspot.com/u/Ktamir)\
**Post date:** [April 2, 2025, 3:56pm UTC](https://community.hubspot.com/t/supercharge-your-hubspot-workflows-generate-short-unique-ids-custom-code-action/129092/3 "2025-04-02T15:56:15Z")

</div>

Thank you for sharing this with me

---

<div class="post-metadata">

**Author:** ![GHubTech](https://avatars.discourse-cdn.com/v4/letter/g/e0b2c6/32.png) [@GHubTech](https://community.hubspot.com/u/GHubTech)\
**Post date:** [May 14, 2025, 5:54am UTC](https://community.hubspot.com/t/supercharge-your-hubspot-workflows-generate-short-unique-ids-custom-code-action/129092/4 "2025-05-14T05:54:16Z")

</div>

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.

 ![1152192_1_Screenshot 2025-05-14 135236.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/e/0/e0b74b17a2d978698dd827b8d7c5de11655b6d74.png)

 ![1152192_2_Screenshot 2025-05-14 135214.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/a/e/ae6a46ed6d9b11c9d1cdded20e36dbb56f8ad77c.png)

---

<div class="post-metadata">

**Author:** ![rverheijen](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/rverheijen/32/37160_2.png) [@rverheijen](https://community.hubspot.com/u/rverheijen)\
**Post date:** [May 14, 2025, 9:17am UTC](https://community.hubspot.com/t/supercharge-your-hubspot-workflows-generate-short-unique-ids-custom-code-action/129092/5 "2025-05-14T09:17:04Z")

</div>

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](https://d2qpr2jzcazej7.cloudfront.net/original/3X/5/0/50512eb47c47f75e06464a7fdc4d38315871771b.png)

 ![](https://d2qpr2jzcazej7.cloudfront.net/original/3X/b/f/bf48404b298250a5f06b03f9797fed958667509a.png)

---

<div class="post-metadata">

**Author:** ![rverheijen](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/rverheijen/32/37160_2.png) [@rverheijen](https://community.hubspot.com/u/rverheijen)\
**Post date:** [May 14, 2025, 12:04pm UTC](https://community.hubspot.com/t/supercharge-your-hubspot-workflows-generate-short-unique-ids-custom-code-action/129092/6 "2025-05-14T12:04:20Z")

</div>

And the short\_uuid in the ‘Choose a value’ field could be found under ‘Action outputs’, ‘Custom code’.

 ![rverheijen_0-1747223987732.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/b/4/b456f1f83cb016a380cb44bc9482ac3c8b94106a.png)

---

<div class="post-metadata">

**Author:** ![GHubTech](https://avatars.discourse-cdn.com/v4/letter/g/e0b2c6/32.png) [@GHubTech](https://community.hubspot.com/u/GHubTech)\
**Post date:** [May 15, 2025, 9:54pm UTC](https://community.hubspot.com/t/supercharge-your-hubspot-workflows-generate-short-unique-ids-custom-code-action/129092/7 "2025-05-15T21:54:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rverheijen](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/rverheijen/32/37160_2.png) [@rverheijen](https://community.hubspot.com/u/rverheijen)\
**Post date:** [May 16, 2025, 9:57am UTC](https://community.hubspot.com/t/supercharge-your-hubspot-workflows-generate-short-unique-ids-custom-code-action/129092/8 "2025-05-16T09:57:54Z")

</div>

Replied 😉
