function checkDep(){
if (nlapiGetFieldValue('isinactive')=='T'){
var searchFilters = new Array();
searchFilters[0] = new nlobjSearchFilter('department',null,'is',nlapiGetRecordId());
var searchColumns = new Array();
searchColumns[0] = new nlobjSearchColumn('internalid');
var items = nlapiSearchRecord('inventoryitem', null, searchFilters, searchColumns);
if (items.length>0) {
throw 'Unable to Deactivate Department. '+items.length+' item/s use/s it.';
}
}
}
No comments:
Post a Comment