"/ "**
* @NApiVersion 2.x
* @NScriptType ClientScript
* @AppliesTo Record Item Receipt
*/
define(['N/ui/message'], function(message) {
function saveRecord(context) {
var currentRecord = context.currentRecord;
// Get the value of the bin field
var binValue = currentRecord.getValue({ fieldId: 'binnumber' });
// Check if the bin field is null or empty
if (!binValue) {
// Show a pop-up message if the bin field is empty
message.create({
title: 'Bin Field is Empty',
message: 'Please fill in the bin field',
type: message.Type.ERROR
}).show();
// Do not save the record
return false;
}
// Save the record if the bin field is not empty
return true;
}
return {
saveRecord: saveRecord
};
});