Script: Userevent When creating the lost lead or lead record on after submit trigger will fetch the required details and post it to Klaviyo by API POST request. /** * @NApiVersion 2.1 * @NScriptType UserEventScript */ /************************************************************************************************ * * NetSuite – Klaviyo Integration Lost leads** * * User event script for reak time API integration… Continue reading Add members to Klaviyo list (Lost Lead sync)
Author: Vishnu P
Converting credentials to base 64 formats for the API call (Access token retrieval)
The function converts the string combining the username and password to base 64 format and apply in the API call for generating the access token. Sample API request code snippet let accessTokenresponse = https.post({ url: AUTH_URL, headers: { ‘Content-Type’: ‘application/x-www-form-urlencoded’, ‘Authorization’: ‘Basic ‘ + getBasicAuthorisation(credentialFetch), }, body: { ‘grant_type’: ‘client_credentials’, } }); /** * @description… Continue reading Converting credentials to base 64 formats for the API call (Access token retrieval)
Search to get item child name
Use the below formula to return only the item’s child name in a saved search. Formula(Text): ltrim(regexp_substr({name},'[^:]*$’)) For example without the formula a parent: child item will display as: Parent Item Name: Child Item Name Using the formula only the Child Item Name will display. search export:var itemSearchObj = search.create({type: “item”,filters:[[“name”,”is”,”SKTHA96976″]],columns:[search.createColumn({name: “itemid”,sort: search.Sort.ASC,label: “Name”}),search.createColumn({name: “formulatext”,formula: ” ltrim(regexp_substr({name},'[^:]*$’))”,label: “Formula (Text)”})]});
Calling suitelet from HTML by AJAX method (Backend function)
function fetchDetails(){ let internalIdArrayCheck=CUSTOM_IF_DETAILED_ARRAY.split(‘_’); if(internalIdArrayCheck.length==1) { console.log(‘CUSTOM_IF_DETAILED_ARRAY’,CUSTOM_IF_DETAILED_ARRAY) $.get(‘/app/site/hosting/scriptlet.nl?script=1525&deploy=1&resultData=’ +dataStringify) } setTimeout(“window.close()”, 50); } In this case, the front-end functionality will be running and closing the window, but the suite let we have called will be triggered in the backend and do the functionality. This helps the front end side much faster.
Error when transforming Sales order to item fulfillment
Error has been resolved by adding the default value (inventory location) var itemFulfilmentObj = record.transform({
Email send details and limitations
Sends email to an individual or group of recipients and receives bounceback notifications. A maximum of 10 recipients (recipient + cc + bcc) is allowed. For multiple recipients, use an array of internal IDs or email addresses. You can use an array that contains a combination of internal IDs and email addresses. The total message… Continue reading Email send details and limitations
Address field can directly retrieve from transaction record.
Previously, to anonymize information about addresses, you had to select multiple fields: Shipping Address Country, Override, Shipping Address State, Shipping Address Zip Code, Shipping Address is Residential, Billing Address is Residential, Ship To, Shipping Address, Vendor, and Billing Address. Now, to select all of the corresponding address fields, you can select the Shipping Address and… Continue reading Address field can directly retrieve from transaction record.
Setting the class column in item sub list as mandatory from Company preferences through script
User may set the Class Field to mandatory by ticking the Make Classes Mandatory field on Setup > Accounting > Accounting Preferences > General tab. This can also be done via SuiteScript. var accountingPref = config.load({type: config.Type.ACCOUNTING_PREFERENCES}); accountingPref.setValue({fieldId: ‘CLASSMANDATORY’,value: true}); accountingPref.save();
Getting transactions between two trandate
/** * Fetch transactions created between two dates * @since 2015.2 */function getTransaction () { try { var transactionSearchObj = search.create({ type: “transaction”, filters: [ [“type”, “anyof”, “CustCred”, “CustInvc”], “AND”, [“mainline”, “is”, “F”], “AND”, [“shipping”, “is”, “F”], “AND”, [“cogs”, “is”, “F”] ], columns: [ search.createColumn({ name: “custbody_eb_channel”, summary: “GROUP”, label: “Channel” }), search.createColumn({ name: “formulacurrency”,… Continue reading Getting transactions between two trandate
Window properties in JS
Method Description alert() specifies a method that displays an alert box with a message an OK button. blur() specifies a method that removes the focus from the current window. clearInterval() specifies a method that clears the timer, which is set by using setInterval() method. close() specifies a method that closes the current window. confirm() specifies… Continue reading Window properties in JS