var currentContext = nlapiGetContext();
if(currentContext.getExecutionContext() != 'cvsimport') {
And at the end of the code close the if statement:
}
See simple example below:
function myBeforeSubmitFunction(type, form) {
var currentContext = nlapiGetContext();
if(currentContext.getExecutionContext() != 'cvsimport') {
//Insert all code here to prevent it from running on CSV import
}
}
More advanced example for preventing only part of a script from running:
function myBeforeSubmitFunction(type, form) {
//Execute code here always
var currentContext = nlapiGetContext();
if(currentContext.getExecutionContext() != 'cvsimport') {
//Code not for CSV import
} else {
//Code only run if CSV import is run
}
//Execute code here always
}
Note: After enabling the Run Server SuiteScript and Workflows preference it will also cause workflows to run on CSV imports. Changing existing Workflows so that the Context condition excludes CSV Import might also be required.
No comments:
Post a Comment