This 1.0 code function setCustomerDiscounts(type) { log.debug(‘setCustomerDiscounts’, ‘==START==’); try { if (!isValidForm()) return; var recType = nlapiGetRecordType(); var recId = nlapiGetRecordId(); var lines = getTransactionLines(recId, recType); log.audit(‘Doc No’, ‘Doc No ‘ + nlapiGetFieldValue(‘tranid’)); log.debug(‘lines’, JSON.stringify(lines)); if (ObjectUtils.isEmpty(lines)) return; … Continue reading 1.0 to 2.0 script conversion with sample code
Author: Akshay B Nair
Use an Employee Group as Script Parameter to send emails to these Employees
create an employee group In the group add the employees choose a static group and select the type. Add the employees in the list Add as script parameter these employees email ids can be used in the script now.
To Attach the Customers in the emails
This snippet is to attach the emails sent to the customers in the communication subtab of the corresponding customers let emailOptions = { author: SENDER.CGL_Accounts, // System user recipients: [emailRecipientId], … Continue reading To Attach the Customers in the emails
RENDER ADVANCED PDF VIA SUITELET
define([‘N/record’, ‘N/render’, ‘N/search’], (record, render, search) => { “use strict”; const TEMPLATE_MAP = { salesorder: ‘CUSTTMPL_JJ_SO_HIDE_LINE_ITEM_STBUK154’, estimate: ‘CUSTTMPL_JJ_QUOTE_HIDE_LINE_ITEM_STBUK154’, invoice: ‘CUSTTMPL_JJ_INV_HIDE_LINE_ITEM_STBUK154’, itemfulfillment: ‘CUSTTMPL_JJ_IF_HIDE_LINE_ITEM_STBUK154’ }; /** * Searches and maps SO… Continue reading RENDER ADVANCED PDF VIA SUITELET
CLIENT SCRIPT TO VALIDATE SUITELET PAGES BUTTON ACTION
This code sample is to validate the dates from the sales orders in the suitelet page are changed before save action. if the dates are not changed then alerts the user and restricts save. define([‘N/currentRecord’], /** * @param {*} currentRecord */ (currentRecord) => { … Continue reading CLIENT SCRIPT TO VALIDATE SUITELET PAGES BUTTON ACTION
SUITE LET SCRIPT TO UPDATE A CUSTOM COL LINE FIELD IN SALES ORDER RECORD
This script is used to get the req del date column in the item line and then using the suitelet fields the sales order lines can be updated fo the mentioned roles define([ ‘N/ui/serverWidget’, ‘N/record’, ‘N/runtime’, ‘N/format’ ], /** * *… Continue reading SUITE LET SCRIPT TO UPDATE A CUSTOM COL LINE FIELD IN SALES ORDER RECORD
To Override the Document numbers
If the document numbers of the transactions need to be set in sequence using a script, then the override checkbox in the setup for automatic document numbering needs to be checked. Navigation –>
Saved Search to get the time bills in ascending order of the date
this code sample will give the time bills search result in the ascending order of the date function timeBillSearchData(subsidiaryDateArr, monthYearComboArr, payrollArray) { try { let subsidiaryArray = subsidiaryDateArr.map(item => item.subsidiary); let dateFilters =… Continue reading Saved Search to get the time bills in ascending order of the date
To Get the Runtime Context and set the value of the document number
This code sample will get the run time context and checks if the context is ‘WEBSERVICES’ then fetches the field value of the source and compares if this is equal to ‘web Services’ if the source condition is satisfied then the system fetches the Document number and then suffix it will -WC const afterSubmit =… Continue reading To Get the Runtime Context and set the value of the document number
To Be Emailed in the Transactions
When the customer record has the checkbox checked for email in the preference tab. then the email will be sent for the transactions. for transaction the to be emailed will be checked on transactions. if the transaction on create needs to be emailed to the customer, then the script usage of user event before Load… Continue reading To Be Emailed in the Transactions