darklilcorner
09/29/2023, 1:55 PM/**
* @NApiVersion 2.x
* @NScriptType ClientScript
*/
define(['N/record'],function(record) {
//validateDelete
function validateDelete(scriptContext) {
alert('validateDelete: cannot delete the current line')
return false;
}
return {
validateDelete: validateDelete
};
});
Nathan L
09/29/2023, 2:12 PM/**
* @NApiVersion 2.1
* @NScriptType ClientScript
*/
define(["N/record"], function(record) {
function validateDelete(scriptContext) {
// get your current record object
const {currentRecord} = scriptContext;
// get the approval status of the PO. 2 = Approved
const approvalStatus = currentRecord.getValue({fieldId: 'approvalstatus'})
// if the approval status is 2, then the PO is approved and the line cannot be deleted
if (approvalStatus === '2') {
alert("validateDelete: cannot delete the current line");
return false;
}
// if the approval status is not 2, then the PO is not approved and the line can be deleted
return true;
}
return {
validateDelete: validateDelete
};
});
Nathan L
09/29/2023, 2:12 PMNathan L
09/29/2023, 2:13 PMdarklilcorner
09/29/2023, 2:15 PMdarklilcorner
09/29/2023, 2:16 PMNathan L
09/29/2023, 2:19 PMNathan L
09/29/2023, 2:21 PMdarklilcorner
09/29/2023, 2:30 PM