Creating Conditional Hyperlinks in NetSuite Saved Searches

To display a value (e.g., name, code, ID) as a clickable hyperlink in a NetSuite Saved Search only if a valid URL is present in a related field. If no valid URL exists, the value is shown as plain text instead.

Use Case

Useful in any Saved Search where:

* You want to link to external/internal resources (e.g., websites, portals, documents).

* The base URL may not always be present (e.g., optional configuration or vendor-specific).

General Formula (Text)

sql

CASE 

 WHEN INSTR(LOWER({url_field}), ‘http’) > 0 

  THEN ‘<a href=”‘ 

     || {url_field} 

     || {value_field} 

     || ‘” target=”_blank”>’ 

     || {value_field} 

     || ‘</a>’

 ELSE {value_field}

END

Formula Logic

`INSTR(LOWER(…), ‘http’) > 0`

 Ensures the URL is valid by checking for `’http’` (case-insensitive). Prevents links for values like `’na’`, `’n/a’`, or blank.

`<a href=”…”>…</a>`

 Creates a standard HTML anchor (`<a>`) tag. The display value and URL target are both dynamic.

`target=”_blank”`

 Ensures the link opens in a new browser tab when clicked.

Fallback

 If the URL is not valid, the value appears as plain text.

Leave a comment

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