Keeping records clean and consistent is important for accurate reporting and better user experience. Sometimes, users may accidentally enter duplicate values in a text field (for example: repeating names, tags, or reference numbers).
This Admin Tip shows a simple way to automatically remove duplicate text in a field using a workflow — no script required.
Why use this?
Removing duplicate text helps:
- Keep records clean and readable
- Prevent reporting issues
- Avoid confusion for users
- Maintain consistent data across records
This is especially useful for multi-select or free-text fields where users may enter the same value more than once.
Step-by-Step Guide
Step 1: Create a Workflow
- NetSuite: Go to Customization > Workflow > Workflows > New
- NetSuite Next: Click Explore (hamburger icon in the bottom left corner beside the home button).. In the menu, go to Customization > Workflow > Workflows then click Create workflow button
NetSuite Next:
- Select the record type where the field exists (ex: Customer, Sales Order, Custom Record).
- Name the workflow (ex: Remove Duplicate Text).
- Set Execute on/Event Definition = On Create & On View Or Update
- Click Save.
Step 2: Add a State
- In the workflow diagram, create a new state (ex: Clean Text Field).
- Set it as the initial state if needed.
Step 3: Add a Workflow Action
- Inside the state, click New Action.
- Select Set Field Value.
- Choose the field where duplicates appear.
Step 4: Use a Formula to Clean the Text
This depends on how the text is stored (comma-separated, line breaks, etc.), but the idea is to reformat and standardize the value before saving.
Sample: Sample Scenario
Field contains values like:
Apple, Apple, Orange, Banana
Goal:
Apple, Orange, Banana
Sample Formula (Text)
Use this in the Set Field Value → Formula (Text):
REGEXP_REPLACE({custbody_textfield}, '([^,]+)(,\s*\1)+', '\1')
Step 5: Set Trigger
- Set trigger to Before Record Submit (recommended).
- This ensures the cleaned value saves immediately.
Step 6: Save and Test
- Save the workflow.
- Test by entering duplicate text in the field.
- Save the record and confirm duplicates are removed automatically.
Additional Tips
- Always test in Sandbox first.
- Make sure the workflow does not overwrite valid data.
- Use conditions if you only want it to run when duplicates exist.
- Document the logic so other admins understand the automation.
Summary
Duplicate values in text fields can create confusion and messy data. Using a simple workflow, admins can automatically clean up duplicate text and maintain consistent records without manual updates or scripting.
This small automation can greatly improve data quality and reduce cleanup work for your team.
DISCLAIMER: The sample code described herein is provided on an "as is" basis, without warranty of any kind, to the fullest extent permitted by law. Oracle + NetSuite Inc. does not warrant or guarantee the individual success developers may have in implementing the sample code on their development platforms or in using their own Web server configurations.
Oracle + NetSuite Inc. does not warrant, guarantee or make any representations regarding the use, results of use, accuracy, timeliness or completeness of any data or information relating to the sample code. Oracle + NetSuite Inc. disclaims all warranties, express or implied, and in particular, disclaims all warranties of merchantability, fitness for a particular purpose, and warranties related to the code, or any service or software related thereto.
Oracle + NetSuite Inc. shall not be liable for any direct, indirect or consequential damages or costs of any type arising out of any action taken by you or others related to the sample code.
We would love to hear some of your tips and tricks to manipulate text. Share your insights and experiences in the NetSuite Admin Corner.