2023-05-28

beforeLoad suitescript netsuite

i create an script beforeLoad if status Pending Fulfillment or approval

function beforeLoad(context) {
    

    var currRec = context.newRecord;
        var status = currRec.getValue('status')
        var mem = currRec.getValue('memo')
        var idSo = currRec.getValue('id')
        // log.debug('status', status)
        if (status === 'Pending Fulfillment') {
            record.submitFields({
                type: record.Type.SALES_ORDER,
                id: idSo,
                values: {
                    trandate: null
                },
                
            });
        } else if(status === 'Pending Approval'){
            record.submitFields({
                type: record.Type.SALES_ORDER,
                id: idSo,
                values: {
                    trandate: null
                },
                
            });
        }
    
    }

but when view an sales order that trandate not response. only when once refresh, the script worked



No comments:

Post a Comment