Simple Form – A data entry form that can include a submit button embedded into a portlet. This type supports the N/portlet module that can refresh and resize the portlet, as well as use record-level client script to implement validation. See N/portlet Module. Inline HTML – An HTML-based portlet that is used to display free-form HTML such as… Continue reading Portlet Script Type
Category: SuiteScript Functions
SuiteScript Functions related articles will be posted in this category
SuiteQL: Retrieve Top-Selling Items
SELECT item.itemid, SUM(transactionlines.quantity) AS total_sold FROM transaction INNER JOIN transactionlines ON transaction.id = transactionlines.transaction INNER JOIN item ON transactionlines.item = item.id WHERE transaction.type = ‘SalesOrd’ AND transaction.status = ‘SalesOrd:B’ GROUP BY item.itemid ORDER BY total_sold DESC LIMIT 10; Identifies the top 10 best-selling items based on quantities sold (SUM(transactionlines.quantity)). Filters billed sales… Continue reading SuiteQL: Retrieve Top-Selling Items
SuiteQL: Join Tables-Transactions and Items
SELECT transaction.tranid AS sales_order, item.itemid AS item_name, transactionlines.quantity AS quantity_sold FROM transaction INNER JOIN transactionlines ON transaction.id = transactionlines.transaction INNER JOIN item ON transactionlines.item = item.id WHERE transaction.type = ‘SalesOrd’ AND transaction.trandate BETWEEN {today}-90 AND {today}; Combines data from transaction, transactionlines, and item tables using INNER JOIN. Fetches sales… Continue reading SuiteQL: Join Tables-Transactions and Items
SuiteQL: Parameterized Query Example
SELECT entityid, email, phone FROM customer WHERE id = {customer_id}; A parameterized query that dynamically fetches data for a specific customer using customer_id. Retrieves entityid (customer name), email, and phone.
SuiteQL: Filter Transactions by Date Range
SELECT tranid, entity, trandate, total FROM transaction WHERE type = ‘SalesOrd’ AND trandate BETWEEN {today}-30 AND {today} ORDER BY trandate DESC; Retrieves all Sales Orders (type = ‘SalesOrd’) created in the last 30 days. The trandate filter ensures only transactions within the specified date range are included. Results are sorted in descending order of trandate,… Continue reading SuiteQL: Filter Transactions by Date Range
SuiteQL: Retrieve all customers’ names and email addresses.
SELECT entityid, email FROM customer WHERE isinactive = ‘F’ ORDER BY entityid ASC; This query retrieves all active customers (isinactive = ‘F’). It selects the entityid (customer name) and their email. The results are sorted alphabetically by entityid using ORDER BY ASC.
Applying logic to button Make Copy
const lineIsCopied = () => { let lineNumber = opportunity.getCurrentSublistValue({ sublistId: ‘item’, fieldId: ‘line’ }); if (lineNumber) { //linenumber is existing this means line is not a copy return false; } else { //linenumber is empty this mean line is a copy return true; } };
Optimizing SuiteScript Performance
There are certain changes you can make to your scripts to ensure the execute with performance in mind. This may be particularly true for custom scripts. You can see if there are custom scripts in your account at Customization > Scripting > Scripts. The following guidelines are suggested to optimize script performance: General Scripting Guidelines Accessing… Continue reading Optimizing SuiteScript Performance
Creating and Customizing Sublists in NetSuite with SuiteScript
1. Overview of Sublists in NetSuite SuiteScript Sublists are essential components in NetSuite that allow developers to display tabular data on custom records, Suitelets, or custom forms. Using SuiteScript, you can create and configure Sublists to show related data, capture user input, or present data summaries for transactions, records, or reports. Sublists enhance usability by… Continue reading Creating and Customizing Sublists in NetSuite with SuiteScript
Directly Triggering Suitelets on Button Click in NetSuite (Without Client Scripts)
1. Overview In NetSuite, Suitelets can be executed by clicking a button on a record. While a Client Script is commonly used to handle button actions, it’s possible to simplify this process by configuring the button to directly open a Suitelet URL. This approach minimizes additional script dependencies and can streamline Suitelet execution in simpler… Continue reading Directly Triggering Suitelets on Button Click in NetSuite (Without Client Scripts)