You can make the portlet script available as a SuiteApp portlet or as a custom portlet. Dashboard SuiteApp Portlet – You can designate that a portlet script should be used for a SuiteApp portlet. A SuiteApp portlet is a specialized type of custom portlet that provides direct access from users’ dashboards to a SuiteApp installed in… Continue reading SuiteApp portlet and custom portlet
Category: SuiteScript Functions
SuiteScript Functions related articles will be posted in this category
Guidelines for Creating a Dashboard SuiteApp Icon
Dashboard SuiteApp icons require certain visual characteristics to align them with other icons in the dashboard. The following guidelines preserve the visual characteristics of Dashboard SuiteApp icons: Dashboard SuiteApp icons use a unique background with a cloud motif. This background ensures a common size and shape for all Dashboard SuiteApp icons and provides a cloud… Continue reading Guidelines for Creating a Dashboard SuiteApp Icon
Portlet Script Type
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
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