Foundations Apex API Developer Reference


global abstract class ffasync_Process

This class is the main entry point for the system. It must be implemented.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

You need to provide some sample code



This class specifies the Monitoring Types which are supported by the framework. The supported values are DETAILED and SIMPLE.

Value Description
DETAILED Detailed Monitoring creates Process Log records, [optionally] Process User Group records and provides processed items success and failure counts.
SIMPLE Simple Monitoring does not create Process Logs records, Process User Group records or provide processed items success or failure counts. It is comparatively faster than Detailed monitoring if all other parameters are the same.



global ffasync_Process()


global abstract Database.QueryLocator getQueryLocator()

Return the query locator for your process.

Return Value

Database.QueryLocator - records to be run for this Process


global abstract fferpcore.ffasync_Process.Step getStep()

Get the step that will be run for each chunk of records.

Return Value

Step class instance


global virtual fferpcore.ffasync_Process.LoggingRequirement getLoggingRequirement()

Get the Logging Requirements for current Process. Takes DETAILED as monitoring type and No userField by default.

Return Value

Ffasync_Process.LoggingRequirement class instance


global virtual String getDescription()

Description of process. Returns Process as process default description if not overrided.

Return Value

Description of process


global virtual Integer getScopeSize()

Scope size for the batch. The default value is 1.

Return Value

Scope size for batch


global virtual List<fferpcore.ffasync_IAction> getEndOfProcessActions()

Some custom actions can be run after Process completion. For example, email or task notifications can be generated to inform users that Process has completed. By default no action will be added.

Return Value

List of actions to be run after Process Completion


global abstract class Step

A step is the work that is to be done on each chunk of records that we have, e.g. a batch execute or a qeueueable execute.



global Step()


global virtual Boolean canRunParallel()

Steps can be executed serially or in parallel. If set to False, the step runs serially. The default value is True, to run the step in parallel.

Return Value

Flag to decide whether to run the step Parallel or Serial


global abstract fferpcore.ffasync_ProcessService.ProcessResponse run(fferpcore.ffasync_ProcessService.ProcessExecutionContext ec, List<Id> recordsIds)

This will be called by the async job for the main task and returns ffasync_ProcessService.ProcessResponse. This will be called by the async job, it could be a batch, queueuable etc.

Input Parameters

Name Type Description
ec fferpcore.ffasync_ProcessService.ProcessExecutionContext Execution Context for running the process.
recordsIds List<Id> The IDs of the records to process.

Return Value

Instance of ProcessResponse, which specifies if all records are processed successfully or failed


global virtual List<SObjectField> getExecutionGroupingFields()

Used to group records by a grouping key and only run a set of records from that group in any one execution. This is useful for things such as FFA company handling, where all records must be in the same company for a given service call and the process may pick up records from many companies. Returns null as default value.

Return Value

List of grouping fields


global virtual class LoggingRequirement

This class holds the properties specific to the logging requirements of the framework.



global LoggingRequirement()


global LoggingRequirement(fferpcore.ffasync_Process.MonitoringType monitoringType, SObjectField userField)

This parameterized constructor enables users to create a LoggingRequirement instance with minimal code without extending the LoggingRequirement class. The default value for MonitoringType is DETAILED and the default value for userField is Null. This default behavior is provided to users unless they override the getLoggingRequirement() method in the Process class. Users can still extend the LoggingRequirement class to provide custom valid values for MonitoringType and UserField.


global virtual fferpcore.ffasync_Process.MonitoringType getMonitoringType()

There are currently two Monitoring Types you can use, Simple and Detailed. Simple monitoring, which is light and fast, does not generate Process Logs or details about the failure or success of processes. Detailed monitoring generates the Process Logs and detailed information about failure or success of the processes. To enable detailed monitoring, DETAILED must be returned from this method. The system runs in detailed mode by default.

Return Value

Monitoring Type which should be used by framework- Detailed or Simple


global virtual SObjectField getUserField()

This field specifies the user that will be notified when the process ends. It can be used to create a custom relationship between records and a user. If this field is specified, then there will be changes in the logging. Records will be created in the database for each UserGroup i.e. groups of source object records on the basis of UserField. This field could be createdByID or another field containing a lookup to user ID on the source object. By default it returns null.

Return Value

Field that specifies the source record user

© Copyright 2009–2021, inc. All rights reserved. Various trademarks held by their respective owners.