Skip to content
Scheduler

Scheduler

The Scheduler module provides framework infrastructure (SchedulerJobInfo, SchedulerQueueable, and SchedulerBatch) to manage, configure, and execute scheduled Queueable and Batch Apex processes.

📘 Feature Documentation: For conceptual setup, cron expressions, and configuration steps, refer to the main Job Scheduler Documentation.


SchedulerJobInfo

Holds operational metadata, execution limits, and security configuration for scheduled Apex processes.

Properties

  • processName: The developer name of the scheduled process (String).
  • jobConfiguration: The job configuration identifier (String).
  • recordConfiguration: The record-level configuration identifier (String).
  • recordLevelSecurity: The record-level security context mode (String).
  • className: The target Apex class name implementing the scheduled job (String).
  • parameters: Input parameters passed into the scheduled job execution (String).
  • interval: The execution interval for the scheduled process (Integer).
  • isActive: Indicates whether the scheduled job is active (Boolean).
  • chunkSize: The batch scope chunk size (Integer).
  • queryLimit: The maximum query limit applied to context data retrieval (Integer).
  • enableDefaultQueueableFinalizer: Indicates if the default Queueable finalizer is enabled (Boolean).
  • enforceUniqueBatch: Indicates whether duplicate batch executions are prevented (Boolean).
  • isFeatureEnabled: Indicates whether the feature toggle controlling the job is active (Boolean).
  • featureFlag: The feature flag developer name (String).

SchedulerQueueable

Base class for Queueable jobs managed by the framework scheduler.

SchedulerQueueable(String queueableClassName)

Constructor initializing the queueable class context name.

Signature:

public SchedulerQueueable(String queueableClassName)

init(SchedulerJobInfo schedulerConfig)

Initializes class properties using the provided SchedulerJobInfo configuration.

Signature:

public forvendi.SchedulerQueueable init(forvendi.SchedulerJobInfo schedulerConfig)

Parameters:

  • schedulerConfig: Job configuration object.

Return Value: forvendi.SchedulerQueueable – New instance or self-reference.


run()

Triggers execution of the scheduled Queueable job.

Signature:

public void run()

execute(ModificationContext ctx)

Executes job logic within the provided ModificationContext.

Signature:

public void execute(forvendi.ModificationContext ctx)

Parameters:

  • ctx: The modification context handling transactional DML.

execute(QueueableContext queueableContext)

Standard System.Queueable execution handler managing logging and error catching.

Signature:

public void execute(System.QueueableContext queueableContext)

Parameters:

  • queueableContext: System queueable context.

SchedulerBatch

Base class for Batch Apex jobs managed by the framework scheduler.

SchedulerBatch()

Default constructor.

Signature:

public SchedulerBatch()

init(SchedulerJobInfo schedulerConfig)

Initializes batch execution parameters using SchedulerJobInfo.

Signature:

public forvendi.SchedulerBatch init(forvendi.SchedulerJobInfo schedulerConfig)

Parameters:

  • schedulerConfig: Job configuration object.

Return Value: forvendi.SchedulerBatch – New instance or self-reference.


prepareContextQuery()

Prepares and returns the SOQL query string used to retrieve the batch scope.

Signature:

public String prepareContextQuery()

Return Value: String – Prepared SOQL query string.


prepareContextIterable()

Prepares and returns a custom iterable of SObjects for batch processing.

Signature:

public Iterable<SObject> prepareContextIterable()

Return Value: Iterable<SObject> – Custom iterable of SObjects.


prepareCountQuery()

Prepares the count SOQL query string for scope estimation.

Signature:

public String prepareCountQuery()

Return Value: String – Count query string.


execute(SObject[] records, ModificationContext ctx)

Executes logic on a batch slice of SObject records within a ModificationContext.

Signature:

public void execute(SObject[] records, forvendi.ModificationContext ctx)

Parameters:

  • records: Slice of SObject records to process.
  • ctx: Modification context for tracking DML.

execute(Database.BatchableContext context, SObject[] scope)

Standard Database.Batchable execution pass.

Signature:

public void execute(Database.BatchableContext context, SObject[] scope)

Parameters:

  • context: System batch context.
  • scope: Array of SObject records for the current iteration.

shouldRun()

Evaluates conditions to check if the batch job should proceed with execution.

Signature:

public Boolean shouldRun()

Return Value: Booleantrue if job should run, false otherwise.


run()

Triggers batch job execution.

Signature:

public void run()

finish()

Finalizes batch process execution.

Signature:

public void finish()