1. Help Center
  2. HubSpot Micro Apps
  3. Workflow Generate Code Actions

What does the 'Generate an Incremental Value/Code' action do?

The 'Generate an Incremental Value/Code' action within the Generate Code Actions app by Integration Glue allows you to automatically generate sequential or incremental values or codes within HubSpot workflows. This action is useful for creating unique identifiers or codes that increment each time the action is triggered, which can be valuable for tracking, inventory management, or generating unique product codes.

The action generates a new code or value based on a predefined starting point, and each time the action runs, it increases the value by a specified increment. This ensures that each generated value or code is unique and sequential, making it easier to track individual items or records.

This action is particularly useful when:

  • You need to generate unique, sequential product codes for inventory or order tracking.
  • You are automating the generation of codes for tickets, cases, or reference numbers that require unique identifiers.
  • You want to create an organized system for tracking records or items based on incremental values, such as order numbers or batch IDs.
 
 Screenshot 2025-01-15 142415
 
  • Property to get and save incremental value is the HubSpot property where the incremental value or code will be stored. The action will look at this property to check for any previously saved value, and the next incremented value will be stored here. If there’s an existing value, the action will increment it. If not, the default value will be used (as set in the next field). This property helps keep track of the last used value so that the increment happens correctly with each new trigger
  • Default value (if there is no value already saved in the above property) is the starting value that will be used if the selected property (from the previous field) is empty or doesn't have a value. This ensures that even if there’s no prior value saved in the property, the action will have a number or code to start from. For example, you might set it to "1" or "1000" depending on your needs.
  • Number to increment value by specifies by how much the value should increase each time the action is triggered. You’ll set the increment value (e.g., 1, 5, 10, etc.), so the action generates the next value by adding this number to the last saved value in the property. For example, if the last saved value is "1000" and you set this field to "1," the next generated value will be "1001."

Step 1: Add the Action to the Workflow

  • Open your HubSpot workflow editor.
  • Click the "+" button to add a new action.
  • From the available app actions, select Generate Code Actions and choose 'Generate an Incremental Value/Code'.

Step 2: Select the Property to Get and Save the Incremental Value

  • Title: Choose the Property for Incremental Value
  • In the action setup panel, locate the 'Property to get and save incremental value' field.
  • Select the HubSpot property where the incremental value or code will be stored. This could be a custom property that tracks the generated value, such as an "Order Number" or "Ticket ID" field.

Step 3: Set the Default Value

  • Title: Set the Default Value
  • Next, locate the 'Default value' field.
  • Enter a starting value that will be used if the selected property does not already have a value saved. For example, you can set it to 1, 1000, or any other starting number that makes sense for your workflow.
  • This ensures that the action has a value to start from if it's the first time the workflow is triggered.

Step 4: Specify the Number to Increment By

  • Title: Define the Increment Value
  • Find the 'Number to increment value by' field.
  • Enter the value by which the generated code or number should increase with each trigger. For example:
    • If you want the value to increment by 1 (e.g., 1, 2, 3, etc.), set this field to 1.
    • If you want a larger increment, like generating a series of codes 5 apart (e.g., 1000, 1005, 1010, etc.), set this field to 5.

Step 5: Save and Test the Workflow

  • Once all fields are configured, click Save to finalize the setup.
  • To test the workflow:
    • Trigger the workflow and check that the incremental value or code is generated correctly.
    • Ensure that the value is stored in the selected property and that it increments by the specified amount each time the action is executed.