snipt

Ctrl+h for KB shortcuts

Java

Abort All Jobs

1
2
3
4
5
6
try{
	for(CronTrigger ct: [SELECT Id FROM CronTrigger LIMIT :Limits.getLimitDMLRows()]){
    	System.abortjob(ct.Id);
    }
}
catch(Exception e){}
https://snipt.net/embed/77101ea50344f3d293035342e73c8ea2/
/raw/77101ea50344f3d293035342e73c8ea2/
77101ea50344f3d293035342e73c8ea2
java
Java
6
2019-06-24T14:55:21
True
False
False
Feb 06, 2014 at 06:30 AM
/api/public/snipt/111366/
abort-all-jobs
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="k">try</span><span class="o">{</span> </span><span id="L-2"><a name="L-2"></a> <span class="k">for</span><span class="o">(</span><span class="n">CronTrigger</span> <span class="n">ct</span><span class="o">:</span> <span class="o">[</span><span class="n">SELECT</span> <span class="n">Id</span> <span class="n">FROM</span> <span class="n">CronTrigger</span> <span class="n">LIMIT</span> <span class="o">:</span><span class="n">Limits</span><span class="o">.</span><span class="na">getLimitDMLRows</span><span class="o">()]){</span> </span><span id="L-3"><a name="L-3"></a> <span class="n">System</span><span class="o">.</span><span class="na">abortjob</span><span class="o">(</span><span class="n">ct</span><span class="o">.</span><span class="na">Id</span><span class="o">);</span> </span><span id="L-4"><a name="L-4"></a> <span class="o">}</span> </span><span id="L-5"><a name="L-5"></a><span class="o">}</span> </span><span id="L-6"><a name="L-6"></a><span class="k">catch</span><span class="o">(</span><span class="n">Exception</span> <span class="n">e</span><span class="o">){}</span> </span></pre></div> </td></tr></table>
salesforce