N/query suitescript sample

/**  * @NApiVersion 2.x  * @NScriptType Suitelet  */ define([‘N/query’, ‘N/record’, ‘N/ui/serverWidget’, ‘N/log’], function(query, record, serverWidget, log) {     function onRequest(context) {         if (context.request.method === ‘GET’) {             var form = serverWidget.createForm({                 title: ‘Customer and Sales Order List’… Continue reading N/query suitescript sample

Solution to Sort Alphanumeric text values in search because sort.desc will give 9 greater

let searchResult = search.create({ type: search.Type.VENDOR_PAYMENT, filters: [ [‘custbody_2663_reference_num’, ‘startswith’, ‘ACH_’ + formattedToday] ], columns: [ search.createColumn({ name: ‘custbody_2663_reference_num’ }) ] }).run().getRange({ start: 0, end: 1000 }); let sortedResults = searchResult.sort((a, b) => { let aNum = parseInt(a.getValue(‘custbody_2663_reference_num’).split(‘_’).pop()); let bNum = parseInt(b.getValue(‘custbody_2663_reference_num’).split(‘_’).pop()); return bNum – aNum; // Sort in descending order }); // Get the… Continue reading Solution to Sort Alphanumeric text values in search because sort.desc will give 9 greater

Change the alignment according to the length of the value in Advanced html PDF template

<#if item.custrecord_vr_svcord_item_lotnum?length > 3>     <td colspan=”7″ style=”border: 1px solid rgb(187, 187, 187);” align=”left”>         ${item.custrecord_vr_svcord_item_lotnum}     </td> <#else>     <td colspan=”7″ style=”border: 1px solid rgb(187, 187, 187);” align=”center”>         <#if item.custrecord_vr_svcord_item_lotnum?has_content>             ${item.custrecord_vr_svcord_item_lotnum}         <#else>    … Continue reading Change the alignment according to the length of the value in Advanced html PDF template

Number to words for USD

    function numberToWords(num) {         const units = [‘Zero’, ‘One’, ‘Two’, ‘Three’, ‘Four’, ‘Five’, ‘Six’, ‘Seven’, ‘Eight’, ‘Nine’];         const teens = [‘Ten’, ‘Eleven’, ‘Twelve’, ‘Thirteen’, ‘Fourteen’, ‘Fifteen’, ‘Sixteen’, ‘Seventeen’, ‘Eighteen’, ‘Nineteen’];         const tens = [‘Twenty’, ‘Thirty’, ‘Forty’, ‘Fifty’, ‘Sixty’, ‘Seventy’, ‘Eighty’, ‘Ninety’];  … Continue reading Number to words for USD

Custom record permission issue from customer center

External Access Role permission might be set as NONE in custom record. This option is available only if you selected No Permission Required for Internal Users as the access type. It permits public access to users such as customers, vendors, and partners according to the access level selected. None – User doesn’t have access any instance… Continue reading Custom record permission issue from customer center

How to Change the Default Email When a Support Case is Raised in NetSuite

When managing support cases in NetSuite, it’s essential to have the correct contact person assigned by default. This ensures that the right individual receives notifications and can respond promptly. The default contact for support cases is often linked to the list of Authorized Contacts in your NetSuite account. These individuals are designated to interact with… Continue reading How to Change the Default Email When a Support Case is Raised in NetSuite

Code to Reset Suitelet Page (Cancel button).

Suitelet Script: form.addButton({                 id: ‘custpage_cancel_button’,                 label: ‘Cancel’,                 functionName: ‘cancel’             }); Client Script:  function cancel() {         history.back();     }

Change alignment in advanced pdf/html template according to character length

<#if item.custrecord_vr_svcord_item_lotnum?length > 3>     <td colspan=”7″ style=”border: 1px solid rgb(187, 187, 187);” align=”left”>         ${item.custrecord_vr_svcord_item_lotnum}     </td> <#else>     <td colspan=”7″ style=”border: 1px solid rgb(187, 187, 187);” align=”center”>         <#if item.custrecord_vr_svcord_item_lotnum?has_content>             ${item.custrecord_vr_svcord_item_lotnum}         <#else>    … Continue reading Change alignment in advanced pdf/html template according to character length