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

Picked, Packed and Shipped Date on Item Fulfillment

Enable the Update Transaction Date Upon Fulfillment Status Change preference to pick items in one accounting period and ship in another accounting period. Go to Setup -> Accounting -> Accounting Preferences -> Order Management(Subtab) -> Fulfillment Section -> Check the field “Update Transaction Date Upon Fulfillment Status Change”. After the order status is marked Shipped,… Continue reading Picked, Packed and Shipped Date on Item Fulfillment

Timezone Used When Using JavaScript Date Object to Grab Current Time and Date

Running the sample script on the client side will use the time zone that the user’s device is using. If the computer time zone is set to EST then it will return the date and time in EST. Running the same script as a  User Event or a Scheduled Script will use NetSuite’s server time zone which is in PST. Developers… Continue reading Timezone Used When Using JavaScript Date Object to Grab Current Time and Date

Set Sales Order’s Supply Required by Date to current date according to account time zone via SuiteScript

var targetTime = new Date(); targetTime.setMinutes(targetTime.getMinutes() + targetTime.getTimezoneOffset()) let soRec = record.load({ type:’salesorder’, id:51451//internal is of sales order }); soRec.setSublistValue({ sublistId: ‘item’, fieldId: ‘requesteddate’, line: 0, value: targetTime }); soRec.save()

Convert Date() to a Different Time Zone Using JavaScript

Scenario User would like to get the current date in a different time zone using JavaScript. Solution In the following code snippet, currDate variable holds the current date and time in the given time zone: var toTimeZone=”+5:30″;var tz;if(toTimeZone.search(“:”)==-1){tz=parseFloat(toTimeZone);}else{tz=parseFloat(toTimeZone.slice(0,toTimeZone.search(“:”)))+parseFloat(toTimeZone.slice(toTimeZone.search(“:”)+1)/60)}var date = new Date();var utc = date.getTime() + (date.getTimezoneOffset() * 60000);var currDate = new Date(utc + (3600000*tz));currDate = currDate.toString();var currDate… Continue reading Convert Date() to a Different Time Zone Using JavaScript

Setting Field Values Using the Date JavaScript Object

Scenario:A developer uses the JavaScript Object new Date() when setting date field values via SuiteScript and is uncertain of the timezone being used by the API. Solution: The date and time that is set to fields accepting new Date() varies depending on the current timezone set on the local computer it is running on. So in order… Continue reading Setting Field Values Using the Date JavaScript Object

Change date format

/** * @description To format the Date Object into the given type/format * @param {Date} dateObj * @param {String} type * @returns {boolean|String} */ function formatDate(dateObj, type) { let dateAsKeys = splitDate(dateObj); if (dateAsKeys) switch (type) { case ‘MM/DD/YYYY’: ; case ‘M/D/YYYY’: return dateLogic.changeDateFormat(dateAsKeys, type, ‘/’); case ‘D/M/YYYY’: ; case ‘DD/MM/YYYY’: return changeDateFormat(dateAsKeys, type, ‘/’);… Continue reading Change date format