try {
let empLocation = currentRec.getValue({
fieldId: ‘custpage_saleslocation_field’
})
let trandate = currentRec.getValue({ fieldId: ‘trandate’ });
let trandateStr = format.format({
value: trandate,
type: format.Type.DATE
});
let trandateParsed = new Date(trandateStr);
let compareDate = new Date(‘2024-07-02’);
console.log(‘trandate’,trandate);
console.log(‘trandateParsed’, trandateParsed);
console.log(‘compareDate’, compareDate);
console.log(’empLocation’, empLocation);
if(trandateParsed > compareDate ){
if (empLocation == ecommerceLocation) {
currentRec.setValue({
fieldId: ‘custbody52’,
value: SALES_ORDER_TYE_OBJECT.PHONE_ORDER
});
}
else {
currentRec.setValue({
fieldId: ‘custbody52’,
value: SALES_ORDER_TYE_OBJECT.REGULAR_STORE_ORDER
});
}
}
}
catch (err) {
console.error(‘error@performLocationBasedOrderTypeSetting_AHAP2463’, err)
}