Skip to main content
SalesWings Toolbox Execution Mechanism

Overview of the SalesWings Toolbox execution mechanism.

Pauline from SalesWings avatar
Written by Pauline from SalesWings
Updated over a week ago


To update records SalesWings Toolbox makes use of scheduled and asynchronous jobs that run regularly. Knowing how all this works is key to understanding how the Salesforce platform is engaged at any given time.

Turning The Engine On or Off

The engine is turned on or off from exclusively from the SWT Rule Center page (Salesforce gives a possibility to abort both scheduled and async jobs from the Scheduled Jobs and Apex Jobs pages respectively, but that is not recommended as there might be more than 1 job scheduled or queued at a given time. Turning the engine off from the SWT Rule Center page will take care of all of them at once).

The Concept

When the engine is turned on the following will happen:

  1. a scheduled job named SalesWings Toolbox : Watcher will be immediately created.

  2. SalesWing Toolbox : Watcher will execute 1 minute after the synchronization was turned on, and subsequently every hour (this means that 1 scheduled job slot will be permanently occupied by it). Its execution will trigger (a job associated with the class RuleEngineSchedulable will appear in the Apex Jobs page) the execution cycle made up of different jobs.

  3. Each job runs as independent Apex Job associated with a class having SwtJob as a prefix.

  4. The last job, named SwtJobCleaner, wraps up the cycle and schedules the next execution to run after a certain number of minutes, as defined in the Rule Engine Batch Minutes Interval field in Custom Settings [SW Toolbox]. It will scheduled a job named SalesWings Toolbox : Runner (this requires an additional, but temporary, scheduled job slot).

  5. After the given number of minutes SalesWings Toolbox : Runner executes and step 3 is repeated.

The Concept Visualized

More on SalesWings Toolbox : Watcher

This scheduled job is tasked with the following responsibilities:

  • Kicking off the engine execution the first time it’s scheduled

  • Restarting the engine if, for some reason, it failed to re-enqueue itself.

Keeping Track

For every execution cycle a set of corresponding log records is created.

  • SWT Rule Engine Execution: it’s the record responsible of tracking the whole execution across all the rules

  • SWT Rule Set Execution: for each rule set a record log is created and linked to the SWT Rule Engine Execution.

SWT Rule Execution: for each rule execution a record log is created and linked to the SWT Rule Set Execution

List of SWT Rule Engine Executions

List of SWT Rule Set Executions

The Statuses

The following statuses can be assigned to the records depending on the processing and outcome of the engine execution.

SWT Rule Engine Execution

  • QUEUED: a new engine execution has been prepared (all the rule sets and rules have been examined) and it’s queued to be executed shortly.

  • PROCESS: the engine is processing all the rules, calculating values on backup records.

  • APPLY: after processing all the rules the engine is now applying the new values to the records examined in the PROCESS phase.

  • SWEEP: after applying all the value the engine is checking for any records whose value needs to be reverted (either because they fell out of scope, or rule sets/rules have deactivated/deleted).

  • CLEAN: if there were no unexpected errors in previous phases, any deleted rule set/rule is deleted.

  • COMPLETED: the engine execution completed.

  • FAILED: the engine execution could not complete because of a irrecoverable error (support must be contacted).

SWT Rule Set Execution

  • STARTED: the rule set has began to be processed (SWT Rule Engine Execution is PROCESS). This state will remain the same till all the rules belonging to the rule set have been processed.

  • COMPLETED: the rule set, its rules, were all processed.

  • FAILED: the rule set processing could not be completed because of an irrecoverable error.

SWT Rule Execution

  • STARTED: the rule has began to be processed (SWT Rule Engine Execution is PROCESS).

  • COMPLETED: the rule was processed.

  • FAILED: the rule processing could not be completed because of an irrecoverable error. Connected with this the SWT Rule could be marked as Invalid.

Isolating the Jobs

To better isolate SalesWings Toolbox jobs from the others running in the organization create a view and use the following filters:


View Name



Apex Jobs

SW Toolbox Steps

  • Apex Class starts with SwtJob

Contains only the jobs that correspond to each execution phase

Scheduled Jobs

SW Toolbox

  • Job Name starts with SalesWings Toolbox

Contains all the scheduled jobs created by the solution

Number of SWT Rule Engine Executions

The number of SWT Rule Engine Execution records kept is determined by the value of the Apex Jobs Number Threshold field in the Custom Settings [SW Toolbox].

Don't hesitate to schedule a Training Call with us!

Did this answer your question?