Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The NetSuite Pro

The NetSuite Pro Logo The NetSuite Pro Logo

The NetSuite Pro Navigation

  • Home
  • About Us
  • Tutorials
    • NetSuite Scripting
    • Advanced PDF Templates in NetSuite
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Home
  • About Us
  • Tutorials
    • NetSuite Scripting
    • Advanced PDF Templates in NetSuite
  • Blog
  • Contact Us
Home/ NetSuite Scripting/Saved Search Formula Examples (NetSuite)

Saved Search Formula Examples (NetSuite)

🔹 Why Use Formulas in Saved Searches?

Saved Searches are powerful, but sometimes the built-in filters and columns aren’t enough.
Formulas let you:

  • Add custom logic (IF/ELSE with CASE).
  • Transform field values (e.g., uppercase, substrings).
  • Do date math (days open, overdue, etc.).
  • Group, flag, or categorize results for reporting.

Formulas support Text, Numeric, and Date types.


🔹 Formula Basics

  • Formula (Text) → returns text values.
  • Formula (Numeric) → returns numbers.
  • Formula (Date) → returns dates.

Tip: Always test in small searches first—NetSuite formula syntax is close to Oracle SQL, but with restrictions.


🔹 Common Formula Examples

1) âś… Overdue Flag (Text)

CASE WHEN {duedate} < SYSDATE THEN 'Overdue' ELSE 'On Time' END
  • Returns “Overdue” if due date is before today.
  • Works in Formula (Text) column.

2) âś… Days Open (Numeric)

TRUNC(SYSDATE) - TRUNC({trandate})
  • Calculates number of days since transaction date.
  • Use in Formula (Numeric).

3) âś… Month Name from Date

TO_CHAR({trandate}, 'Month')
  • Extracts month name of the transaction.
  • Use in Formula (Text) column.

4) âś… Current Year Transactions Only (Filter)

EXTRACT(YEAR FROM {trandate}) = EXTRACT(YEAR FROM SYSDATE)
  • Filter for only this year’s transactions.
  • Put under Formula (Numeric) filter → equal to EXTRACT(YEAR FROM SYSDATE).

5) âś… Customer Category: Big vs Small

CASE WHEN {amount} >= 10000 THEN 'High Value'
     WHEN {amount} BETWEEN 5000 AND 9999 THEN 'Medium Value'
     ELSE 'Low Value'
END
  • Classifies transactions into categories.
  • Great for pivot reports in Excel.

6) âś… Remove Time from Date

TRUNC({trandate})
  • Returns only the date (midnight).
  • Helpful for grouping by date without time noise.

7) âś… First 5 Characters of Customer Name

SUBSTR({entityid}, 1, 5)
  • Use in Formula (Text) to extract part of a string.

8) âś… Show Only Weekday Transactions

CASE WHEN TO_CHAR({trandate}, 'DY') IN ('SAT','SUN') THEN 'Weekend' ELSE 'Weekday' END
  • Splits transactions into Weekday vs Weekend.

9) âś… Combine Multiple Fields

{firstname} || ' ' || {lastname}
  • Concatenates two fields (first + last name).
  • Formula (Text).

10) ✅ Aging Buckets (0–30, 31–60, 61+)

CASE 
  WHEN TRUNC(SYSDATE) - TRUNC({duedate}) <= 30 THEN '0-30 Days'
  WHEN TRUNC(SYSDATE) - TRUNC({duedate}) BETWEEN 31 AND 60 THEN '31-60 Days'
  ELSE '61+ Days'
END
  • Classic AR/AP report aging buckets.

🔹 Advanced Examples

11) âś… Find Transactions on Last Day of Month

CASE WHEN {trandate} = LAST_DAY({trandate}) THEN 'Month End' ELSE 'Regular' END

12) âś… Flag International Orders

CASE WHEN {shipcountry} != 'US' THEN 'International' ELSE 'Domestic' END

13) âś… Extract Year-Month Key for Grouping

TO_CHAR({trandate}, 'YYYY-MM')

14) âś… Compare Two Fields

CASE WHEN {total} != {amountpaid} THEN 'Open' ELSE 'Closed' END

🔹 Tips & Best Practices

âś… Use Formula (Text) for labels, categories, or concatenated fields.
âś… Use Formula (Numeric) for counts, days difference, math.
âś… Use Formula (Date) for calculated dates (add days, remove time).
âś… Wrap formulas in CASE for clean logic.
âś… Test in small searches before production.
✅ Remember: SYSDATE = today’s date.


âś… Summary

Saved Search formulas are like “mini SQL” inside NetSuite. They allow you to:

  • Flag records,
  • Classify data,
  • Do math with dates and numbers,
  • Make your reports smarter and easier to analyze.

With formulas, you can transform basic searches into powerful reports and dashboards without custom scripts.

Share
  • Facebook

Sidebar

Ask A Question

Stats

  • Questions 6
  • Answers 6
  • Best Answers 0
  • Users 2
  • Popular
  • Answers
  • Rocky

    Issue in running a client script in NetSuite SuiteScript 2.0 ...

    • 1 Answer
  • admin

    How can I send an email with an attachment in ...

    • 1 Answer
  • admin

    How do I avoid SSS_USAGE_LIMIT_EXCEEDED in a Map/Reduce script?

    • 1 Answer
  • admin
    admin added an answer The issue is usually caused by following Wrong script file… September 14, 2025 at 10:33 pm
  • admin
    admin added an answer Steps to send an Invoice PDF by email: define(['N/email', 'N/render',… August 28, 2025 at 3:05 am
  • admin
    admin added an answer This error means your script hit NetSuite’s governance usage limit… August 28, 2025 at 3:02 am

Top Members

Rocky

Rocky

  • 1 Question
  • 21 Points
Begginer
admin

admin

  • 5 Questions
  • 2 Points

Trending Tags

clientscript netsuite scripting suitescript

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help

Footer

© 2025 The NetSuite Pro. All Rights Reserved