Reputation: 47
I have created simple client script and deployed on both invoice and item fulfillment record. The script is execution on item fulfillment, I can see alert. But same script is not execution on invoice. Please advice!
/**
*@NApiVersion 2.x
*@NScriptType ClientScript
*/
define(['N/record', 'N/ui/dialog'],
function(record,dialog) {
function saveRecord(context) {
alert("saverecord executing");
log.debug("saverecord");
}
function pageInit(context) {
alert("pageinit");
log.debug("pageinit");
}
return {
saveRecord: saveRecord,
pageInit:pageInit
};
}
);
Upvotes: 0
Views: 20
Reputation: 236
Try deleting the existing deployment and re-creating one for the Invoice. Also make sure that 'All Roles' and 'All Employees' checkboxes are checked on the deployment record.
Also use a try-catch block for your code. In the catch section you can use logger to check for errors, if any.
/**
*@NApiVersion 2.x
*@NScriptType ClientScript
*/
define(['N/record', 'N/ui/dialog'], function (record, dialog) {
function saveRecord(context) {
try {
alert("saverecord executing");
log.debug("saverecord");
} catch (e) {
log.debug('Error: ', e.message);
}
}
function pageInit(context) {
try {
alert("pageinit");
log.debug("pageinit");
} catch (e) {
log.debug('Error: ', e.message);
}
}
return {
saveRecord: saveRecord,
pageInit: pageInit
};
})
Upvotes: 0