Purpose
The primary purpose of this workflow action is to automatically find specified text within a string (such as a property value) and replace it with different text.
For example, if a "Notes" property contains "ABC-001," you can replace "001" with "002" to get the result "ABC-002." The replaced string is returned as an "action output" in the workflow, allowing you to save it to a different (or the same) property in a subsequent action.
Use Cases
This feature is useful for automating data formatting, normalization, and the updating of specific information.
- Data Normalization: Standardizing company name suffixes, such as replacing various inputs like "Inc." or "(Corp.)" with the full "Incorporated."
- Removing Unwanted Characters: Finding and replacing hyphens "-" in phone numbers submitted via forms with an empty string (effectively deleting them).
- Updating Information: Bulk replacing old product codes or campaign names with new ones within memo fields or descriptions.
- Dynamic Text Generation: Creating custom messages by replacing parts of a base template string with other property values.
Setup and Execution Steps (As seen in the video)
The video demonstrates a flow where the text "112" within a string is replaced with "204," and the result is then saved to another property.
Step 1: Check Workflow and Trigger
- The process begins in the workflow editor.
- The trigger (enrollment criteria) is set to activate when the "
Event Date" property value is changed.
Step 2: Add the Custom Action
- Click the "+" icon in the workflow to add a new action.
- From the action selection panel, choose "Custome Workflow Starter" from the "Integrated apps" section.
Step 3: Select the Action
- From the list of custom actions that appears, select "Text Replacement Action."
Step 4: Configure the Replacement Rules
- The configuration screen for "Text Replacement Action" opens.
- Base Text: Enter the source string that will be searched. You can use HubSpot property tokens to dynamically set this value from a contact or company property.
- Search Text: Enter the string you want to find within the
Base Text (e.g., "112"). - Replacement Text: Enter the new string that will replace the
Search Text (e.g., "204"). - After configuring, click "Save."
Step 5: Use the Replaced Result (Action Output)
- The "Text Replacement Action" only outputs the result of the replacement. To save this result to a property, a subsequent action is required.
- In the workflow, click the "+" icon after the replacement action and add a standard action like "Set property value" or "Edit record."
- Select the property you want to save the result to (in the video, this is "Message").
- In the value input field, do not use a property token. Instead, select "Action outputs."
- Expand the "
1. Text Replacement Action" (the step number may vary) and select the Replaced Text output token. - This will set the "replaced string" as the value for your chosen property.
Step 6: Verify the Final Result
- Activate the workflow ("Workflow is On") and trigger it.
- Go to the "Enrollment history" tab and open the history details for the executed contact (test@gmail.com).
- In the "Action outputs" for the "
1. Text Replacement Action," you can see the VALUE is test204. (This indicates the original value was "test112," and "112" was replaced with "204".) - The subsequent "
2. Edit record" action also succeeded, confirming that this test204 value was correctly saved to the property.