Catch the Void Action Using a User Event Script

Scenario: Currently, Suitescript does not have the capability yet to catch the Void action on a record. However, we can check if a record is already voided in NetSuite.

sample code

if(scriptContext.type == "edit"){
        var objRecordNew = scriptContext.newRecord;
        var internalID = scriptContext.newRecord.id
        var objRecord = record.load({
                type: record.Type.PURCHASE_ORDER,
                id: internalID,
                isDynamic: true,
        });
        var voided = objRecord.getValue({
                fieldId: 'voided'
        });
       var memo = objRecord.getValue({
                fieldId: 'memo'
        });
 if((memo=='VOID')&&(voided=='T')){
       return true;
}
}

Leave a comment

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