Filtering Sales Orders by Keyword in Document Number or PO# Using Formula (Text) in NetSuite

To filter Sales Orders in NetSuite using a formula that checks whether a given keyword appears in either the Document Number (i.e., tranid) or the PO# (i.e., otherrefnum) field, you can use a Formula (Text) filter in a saved search.

Here’s how to structure it:

Formula (Text) Filter

CASE WHEN {tranid} LIKE '%keyword%' OR {otherrefnum} LIKE '%keyword%' THEN 'Match' ELSE 'No Match' END

✅ Filter Setup in Saved Search

  • Field: Formula (Text)
  • Condition: is equal to
  • Value: Match

Replace keyword with your actual search term

For example, if you’re searching for "ABC123":

CASE WHEN {tranid} LIKE '%ABC123%' OR {otherrefnum} LIKE '%ABC123%' THEN 'Match' ELSE 'No Match' END

Notes

  • This works well for partial matches.
  • If you’re using a dynamic keyword (e.g., from a script or parameter), you’ll need to inject it programmatically.
  • Make sure both fields are indexed or optimized if you’re running this on large datasets.

Leave a comment

Your email address will not be published. Required fields are marked *