This class contains two inner classes used for testing the QueueableProcess framework.
TESTVISIBLE
A 'circuit breaker' to be tripped when the handle exception method is called. This is only used for testing.
private static handleExceptionCalledBoolean
A de-duplication effort to fetch the account by ID. Used only by this class' examples.
public static Account fetchAccountByIdForDemoPurposes(Id accountId)| Name | Type | Description |
|---|---|---|
| accountId | Id | Id account id to fetch. |
Account
Account returns the account object referenced by id.
Step1 is an inner class that conforms to QueueableProcess. It represents an example step in a process that updates an account's shipping street. It also increments the data passthrough by 1.
The Account Id to work with
private final accountIdId
SUPPRESSWARNINGS
This is a required no-arg/no-opp constructor. When/if the class is instantiated by the error handler, this constructor is used.
public Step1()The normal constructor. Accepts a accountId.
public Step1(Id accountId)| Name | Type | Description |
|---|---|---|
| accountId | Id | Id the account id to process. |
This is the main execute method required by the QueueableProcess abstract class. This is where developers will place the code to execute asynchronously in this step. In this case, all it does is fetch an account and increment the shipping street by 1. #riviting.
public override void execute()void
This is an optionally overridable method from the QueueableProcess abstract class. If this method is defined on your class, should the execute method above fail at runtime, the QueueableProcess finalizer will instantiate this class, and call this method. This allows developers to write per-step customized error handling. In this case, we're just setting a static boolean to true so we can test the functionality.
public override void handleException(Exception e)| Name | Type | Description |
|---|---|---|
| e | Exception | Exception any exception object. |
void
This is a second example of a QueueableProcess step. It's very similar to the first, but it manipulates the account phone field.
The Account Id to work with
private final accountIdId
SUPPRESSWARNINGS
a no-arg/no-opp constructor. This is required for the QueueableProcess framework to be instantiated dynamically should an error condition occur during the execution of the process.
public Step2()Standard constructor accepting an account id.
public Step2(Id accountId)| Name | Type | Description |
|---|---|---|
| accountId | Id | Id the account id to process. |
This is the main execute method required by the QueueableProcess abstract class. This is where developers will place the code they want to execute asynchronously in this step. In this case, all it does update the account phone field when the data Passthrough isn't null.
public override void execute()void