result.getText({ name: ‘subsidiary’ }).split(‘:’).pop().trim() || “” result.getText({ name: ‘subsidiary’ }) Retrieves the text representation of the subsidiary field from the search result. In NetSuite, getText is used to fetch the displayed text instead of the internal ID. .split(‘:’) Splits the retrieved text by the colon (:) separator. Some NetSuite fields (like subsidiary) can return values… Continue reading Retrieve only the child subsidiary name from the Subsidiary field using a search.
Author: Nived Krishna
Retrieve invoice details through serch, including Discount Total and Gift Certificate Amount, without loading the record.
let invoiceSearchObj = search.create({ type: ‘invoice’, filters: [ [‘internalid’, ‘anyof’, invoiceArray], // Handling multiple invoices … Continue reading Retrieve invoice details through serch, including Discount Total and Gift Certificate Amount, without loading the record.
SUITEQL to Calculate Subtotal Considering Discount Item
(CASE WHEN COALESCE(discountData.discountTotal, 0) != 0 THEN (COALESCE(transaction.total, 0) – COALESCE(transaction.taxtotal, 0) + (COALESCE(discountData.discountTotal, 0) – COALESCE(discountItemData.discountItem, 0))) ELSE (COALESCE(transaction.total, 0) – COALESCE(transaction.taxtotal, 0)) END) AS invoiceSubtotal LEFT JOIN (SELECT transactionLine.transaction, SUM(ABS(transactionLine.amount)) AS discountTotal FROM transactionLine WHERE transactionLine.itemtype = ‘Discount’ GROUP BY transactionLine.transaction) discountData ON transaction.id = discountData.transaction LEFT JOIN (SELECT transactionLine.transaction, SUM(transactionLine.netamount) AS OtherCharges… Continue reading SUITEQL to Calculate Subtotal Considering Discount Item
Function for checking valid parameters
function isValid(value) { return value !== null && value !== undefined && value !== “”; }
Custom Form with Search and Editable Sublist
/** * @NApiVersion 2.x * @NScriptType Suitelet */ define([‘N/ui/serverWidget’, ‘N/record’, ‘N/search’], function(serverWidget, record, search) { function onRequest(context) { if (context.request.method === ‘GET’) { var form = serverWidget.createForm({ title: ‘Custom Sublist Suitelet’ }); var sublist = form.addSublist({ id: ‘custpage_items’, type: serverWidget.SublistType.INLINEEDITOR, label: ‘Item Details’ }); sublist.addField({ id: ‘custpage_item’, type: serverWidget.FieldType.SELECT, label: ‘Item’, source: ‘item’ }); sublist.addField({… Continue reading Custom Form with Search and Editable Sublist
Prevent Field Editing Based on Condition
/** * @NApiVersion 2.x * @NScriptType ClientScript */ define([‘N/ui/message’], function(message) { function fieldChanged(context) { var currentRecord = context.currentRecord; var fieldId = context.fieldId; if (fieldId === ‘custpage_factor’) { var stage = currentRecord.getValue(‘custpage_stage’); if (!stage) { message.create({ title: “Warning”, message: “You cannot edit the FACTOR field unless STAGE is set.”, type: message.Type.WARNING }).show(); currentRecord.setValue(‘custpage_factor’, ”); } }… Continue reading Prevent Field Editing Based on Condition
SuiteQL Query Tool
/** * @NApiVersion 2.1 * @NScriptType Suitelet * @NModuleScope Public */ /* —————————————————————————————— Script Information —————————————————————————————— Name: SuiteQL Query Tool ID: _suiteql_query_tool Description A utility for running SuiteQL queries in a NetSuite instance. Tim Dietrich * timdietrich@me.com * https://timdietrich.me —————————————————————————————— History —————————————————————————————— 20210714 – Tim Dietrich * First public beta of v2021.2. 20210725 – Tim… Continue reading SuiteQL Query Tool
User Who has Full Permission for Workflow Cannot See Existing Workflows
Scenario Using custom role with proper permission, user navigates to Customization > Workflow > Workflows but some existing workflows are missing. Solution Ensure that the role has permission to the record type(s) where the missing workflows are applied to. For example, if the Workflow is created for Opportunity records, make sure that the role has Opportunity permission with Full access level. Navigate… Continue reading User Who has Full Permission for Workflow Cannot See Existing Workflows
Sending ID Values From Record to List/Record Field of Another Record Using Go to Record Workflow Action
Scenario In some circumstances, sending the name or id value of one record to the List/Record field of another record requires a procedure. For instance, when a new customer record is generated, the name of the newly created customer appears inside the customer List/Record field of a new Sales Order record, pre-populated. Solution Navigate… Continue reading Sending ID Values From Record to List/Record Field of Another Record Using Go to Record Workflow Action
SuiteQL remaining Amount fields for Transactions
For transactions such as Bill Credit, Credit Memo, Customer Deposit, and Payment, we utilize the “transaction.amountremainingbasecurrency” attribute. However, for all other transaction types, we rely on the “transaction.foreignamountunpaid” attribute to determine the remaining balance.