Reputation: 1
The following code won't run in Netsuite. The debugger only highlights the define line not sure what i am doing wrong.
/**
* @NApiVersion 2.x
* @NScriptType ClientScript
*/
define(['N/currentRecord', 'N/ui/message', 'N/ui/dialog'], function(currentRecord, message, dialog) {
function validateLine(context) {
var rec = currentRecord.get();
if (context.sublistId === 'item') {
var lineItemChecked = rec.getCurrentSublistValue({
sublistId: 'item',
fieldId: 'custcol21' // Your custom checkbox field
});
// If the checkbox is checked, show an alert
if (lineItemChecked === true) {
dialog.alert({
title: 'Bulk Delivery Alert',
message: 'Please apply Bulk Delivery for this item.'
});
}
}
return true;
}
return {
validateLine: validateLine
};
});
The script shall run on transaction form, when a line is entered with bulk item check box ticked, the script shall prompt an alert to say Bulk Delivery Apply. However, nothing seems to be happening.
Upvotes: 0
Views: 62
Reputation: 28
How many client scripts are running on that form?
Check on your Deployment and go to Customization -> Scripted Records and selected the type.
You can think of the forms as a type of "Class" which means that when someone makes a custom form it's inherited. There is a chance that someone attached a script to custom form as well. (I am not sure if that shows in the above mentioned Scripted Records.
If there are more than 10 per type of form then the CL won't execute.
Upvotes: 0