I have a scheduled script that does two things. I have checkbox parameters to determine if those things are require on this run of the script. The first time around both are defaulted to true.
function execute(scriptContext) {
var script = runtime.getCurrentScript();
doTask1 = script.getParameter({name: "custscript_tmh_do_task1"});
doTask2 = script.getParameter({name: "custscript_tmh_do_task2"});
if(doTask1){
//Do something
}
if(doTask2){
//Do something
}
//Determine if task1 or task2 needs to happen and set them to true or false.
//Reschedule script if required
if(doTask1 || doTask2){
var scheduledScriptTask = task.create({
taskType: task.TaskType.SCHEDULED_SCRIPT
});
scheduledScriptTask.scriptId = runtime.getCurrentScript().id;
scheduledScriptTask.deploymentId = runtime.getCurrentScript().deploymentId;
scheduledScriptTask.params = {'custscript_tmh_do_task1': doTask1 ,
'custscript_tmh_do_task2': doTask2 };
return scheduledScriptTask.submit();
}
}
The problem is the second time around, it is not doing the tasks when the booleans are set to true. It just skips over them. I have used the debugger to confirm at the point of rescheduling the script the booleans are true.
Question: How do I reschedule a scheduled script with setting a boolean value.
Side Question" I have the parameters created as a script parameter. Is it possible to do this without setting the script parameters in NetSuite?
"T"or"F"values instead oftrueandfalse, so perhaps try setting them that way in your rescheduling logic. - erictgrubaugh