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

Restrict inserting a new sales team line using insert, when existing line has a specific employee

 function validateInsert(scriptContext) {       try {         let currentSublist = scriptContext.sublistId         if (currentSublist == ‘salesteam’) {           let rec = scriptContext.currentRecord;           let lineCount = rec.getLineCount({ sublistId: ‘salesteam’ });           for (let i = 0; i < lineCount; i++) {             let employeeId = rec.getSublistValue({               sublistId: ‘salesteam’,               fieldId: ’employee’,               line: i             });             if (employeeId && employeeId.toString() === TARGET_EMPLOYEE_ID && checkForParameter(role) &&… Continue reading Restrict inserting a new sales team line using insert, when existing line has a specific employee

Restrict roles from selecting values from a field by showing alert

function performTradePartnerOrderValidation(currentRec) {             try{         let newsalesOrderType = currentRec.getValue({           fieldId: ‘custbody52’         });         if(salesOrderType == SALES_ORDER_TYE_OBJECT.TRADE_PARTNER_ORDER && salesOrderType != newsalesOrderType && mode == ‘edit’ && !Object.values(TRADE_PARTNER_ORDER_LOCK).includes(role)) {           alert(“You cannot change the trade partner order. Please contact Administrator for details.”);           currentRec.setValue({             fieldId: ‘custbody52’,             value: salesOrderType           });           return false;         }         return true       }       catch(err) {         console.error(‘error@performTradePartnerOrderValidation’, err)       }… Continue reading Restrict roles from selecting values from a field by showing alert