pretty sure it's not possible but is it at all pos...
# suitescript
m
pretty sure it's not possible but is it at all possible to kill off a scheduled script?
d
Not retrospectively, but if you know ahead of time that you may want to kill it during development: I've seen others mention putting checks into their scheduled script like "if this custom record exists/is active" and then bailing execution in the code if it doesn't pass the check
s
try undeploying it?
I've put a kill switch in the past by using a script parameter - have the script check the killswitch script parameter as it processes
☝️ 1
similar to the custom record approach but keeps it 'closer' to the script.
d
That seems like a much more elegant way to do it
m
sorry, can you explain the kill switch approach? i didn't understand.
s
create a script parameter, like a checkbox and name it something like 'killswitch' or 'abort' or whatever makes sense to you
then in your code, do calls to
getParameter()
periodically in your script. If value is 'true' have the script gracefully exit.
Have that 'abort' parameter be set to
false
in your script deployment initially.
then when you want to abort the script, go into the deployment and check the newly added checkbox.
If your use case is just developing a script that runs something based on a search for example, I'd recommend just limiting your search results to a couple rows during development.
rather than trying to forcibly stop the script executing across many records.
not sure your use case, but that's my $0.02 I guess.
m
thanks for that - sounds like a neat approach