Create a Library Function

/**  * @NApiVersion 2.x  * @NScriptType Suitelet  * @NModuleScope Public  */ define([     ‘../Library.FHL.2.0.js’ ,   ‘N/record’ ,   ‘N/search’ ], function(Library, Record, Search) {     /**      * Initialise function for suitelet      *      * @param {Object} context      * @return {Any} data      */  … Continue reading Create a Library Function

Auto-check “Calculate Tax” based on Subsidiary and Vendor country (US)

function countrySearch(internalId, type) {       try {         let countryValueSearch = search.create({           type: type,           filters: [             [“internalid”, “anyof”, internalId]           ],           columns: [             search.createColumn({ name: “country”, label: “Country” })           ]         });         let searchResult = countryValueSearch.run().getRange({ start: 0, end: 1 });         if (searchResult.length > 0) {           return searchResult[0].getValue({ name: “country” });         }         return null;       } catch (e) {         log.error(“error@countrySearch”,… Continue reading Auto-check “Calculate Tax” based on Subsidiary and Vendor country (US)

Clear Values In Copy Context

function pageInit(context) {       try {         let rec = context.currentRecord;         if (context.mode === ‘copy’) {           let lineCount = rec.getLineCount({ sublistId: ‘item’ });           for (let i = 0; i < lineCount; i++) {             rec.selectLine({ sublistId: ‘item’, line: i });             let woId = rec.getCurrentSublistValue({               sublistId: ‘item’,               fieldId: ‘custcol_jj_linked_wo’,             });             if (woId) {               rec.setCurrentSublistValue({                 sublistId: ‘item’,                 fieldId: ‘custcol_jj_linked_wo’,                 value:… Continue reading Clear Values In Copy Context

Creation Of Journal Entry

 let journal = record.create({           type: record.Type.JOURNAL_ENTRY,           isDynamic: true         });         journal.setValue({ fieldId: ‘subsidiary’, value: subsidiary });         journal.setValue({ fieldId: ‘currency’, value: currency });         journal.setValue({ fieldId: ‘trandate’, value: trandate });         journal.setValue({ fieldId: ‘memo’, value: ‘Auto JE for Income Tax on Vendor Bill ‘ + bill.getValue(‘tranid’) });         // DEBIT A/P         journal.selectNewLine({ sublistId: ‘line’ });         journal.setCurrentSublistValue({ sublistId: ‘line’, fieldId: ‘account’,… Continue reading Creation Of Journal Entry

How to apply journal entry to bill

function transformBillToPayment(billId, journalId, incomeTaxAmount) {       try {         let payment = record.transform({           fromType: record.Type.VENDOR_BILL,           fromId: billId,           toType: record.Type.VENDOR_PAYMENT,           isDynamic: true         });         let applyLineCount = payment.getLineCount({ sublistId: ‘apply’ });         for (let i = 0; i < applyLineCount; i++) {           payment.selectLine({ sublistId: ‘apply’, line: i });           payment.setCurrentSublistValue({             sublistId: ‘apply’,             fieldId: ‘apply’,             value: false           });           payment.commitLine({ sublistId: ‘apply’ });… Continue reading How to apply journal entry to bill

Creation of Journal Entry for Bill

 function createJournalEntry(bill, incomeTaxAmount) {       try {         let vendorId = bill.getValue(‘entity’);         let apAccount = bill.getValue(‘account’);         let subsidiary = bill.getValue(‘subsidiary’);         let currency = bill.getValue(‘currency’);         let trandate = bill.getValue(‘trandate’);         if (!apAccount) {           log.error(‘Missing A/P account on Vendor Bill’);           return null;         }         let journal = record.create({           type: record.Type.JOURNAL_ENTRY,           isDynamic: true         });         journal.setValue({ fieldId: ‘subsidiary’, value: subsidiary });         journal.setValue({ fieldId:… Continue reading Creation of Journal Entry for Bill

How to sent standard invoice email in transaction with PDF attachments

If the standard invoice email is not sending with attachment . We can enable it in the customer prefrence Go to the customer record of that transaction. In the preference, we have email perefrence as PDF, HTML and DEFAULT. Select the PDF. NOTE: If the customer perefence is DEFAULT, then the email will be sent… Continue reading How to sent standard invoice email in transaction with PDF attachments

Disable Note Tab and Email Tab In Edit Mode OF Parent Reocrd

Create a virtual field and inject this code  “DEFAULT_VALUE” : `            <style>             #newhist, #newmessage, #addmessage, #newmail, #newpdf, #newfax,             #refreshmessages, #messagehistory {              opacity: 0.5 !important;              cursor: default !important;             }            </style>            <script>             (function () {              function neutralizeElement(el) {               if (!el) return;                           el.disabled = true;               el.style.opacity = ‘0.5’;               el.style.cursor = ‘default’;               el.style.pointerEvents = ‘auto’;                           [‘click’, ‘mousedown’,… Continue reading Disable Note Tab and Email Tab In Edit Mode OF Parent Reocrd