When running SuiteQL queries on the Customer record, you might want to include the customer's status (e.g., Closed Won) in your results. This is commonly done using BUILTIN.DF(EntityStatus). This built-in function returns the display name (DF = display value) of the status from the related EntityStatus list. However, for customers, these prepends the word "Customer-" to the status label (e.g., "Customer-Closed Won"), which can make your results look cluttered, especially when generating reports or exporting data for your business use.
Original Query:
SELECT
ID,
CompanyName,
BUILTIN.DF(EntityStatus) AS Status
FROM
Customer
Improved Query with Cleaned Status:
SELECT
ID,
CompanyName,
REPLACE(BUILTIN.DF(EntityStatus),'Customer-','') AS Status
FROM
Customer
REPLACE(BUILTIN.DF(EntityStatus),'Customer-','') AS Status
- This function looks for the text
'Customer-' within the display value returned by BUILTIN.DF(EntityStatus) and replaces it with an empty string (''), effectively removing the prefix from the status name.
To easily execute a SuiteQL query, see NetSuite Admin Tip | Running SUITEQL Using a Suitelet
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’d love to hear how you integrate SuiteQL into your NetSuite processes! Share your insights and experiences in the NetSuite Admin Corner.