Set current Date in Date field of netsuite

To set the current date value in the date field of transaction , refer the below sample code

let currentRec = record.load({
                 type: record.Type.SALES_ORDER,
                 id: currentSO.id,
                 isDynamic: true,
             });
let currentDate=new Date();
let newShipDate = generateDateString(date);
let formatedShipDate = format.parse({value: newShipDate ,type: format.Type.DATE});
currentRec.setValue({
           fieldId: 'shipdate',
           value: formatedShipDate
        });
let recordId = currentRec.save({
                        enableSourcing: true,
                        ignoreMandatoryFields: true
                });

Leave a comment

Your email address will not be published. Required fields are marked *