netsuite Tutorial => Restrict execution based on the context that...
Thu Jun 09 2022 06:41:22 GMT+0000 (Coordinated Universal Time)
Saved by
@mdfaizi
#javascript
// 2.0
/**
* @NScriptType UserEventScript
* @NApiVersion 2.x
*/
define(["N/ui/serverWidget", "N/runtime"], function (ui, runtime) {
var exports = {};
function beforeLoad(scriptContext) {
showBonusEligibility(scriptContext.form);
}
function showBonusEligibility(form) {
// Doesn't make sense to modify the form if the
if (!wasTriggeredFromUi(runtime.executionContext)) {
return;
}
// Continue with form modification...
}
function wasTriggeredFromUi(context) {
// Context can be compared to enumeration from runtime module
return (context === runtime.ContextType.USER_INTERFACE);
}
exports.beforeLoad = beforeLoad;
return exports;
});
content_copyCOPY
https://riptutorial.com/netsuite/example/24049/restrict-execution-based-on-the-context-that-triggered-the-user-event
Comments