fferpcore.ffasync_ProcessServiceglobal with sharing class ffasync_ProcessService The service class used to perform background processing operations on the supplied processes. Methods
hasProcessCompletedglobal static void hasProcessCompleted(Id processRunId, fferpcore.ffasync_ProcessService.ICallback callBack) Supports checking whether a process has completed. IMPORTANT the call back may occur in a different apex transaction, as checking some processes with many records could require more querying than can be done in a single apex call due to governor limits. Input Parameters
addProcessglobal static void addProcess(fferpcore.ffasync_ProcessService.ProcessExecutionContext ctxt, fferpcore.ffasync_Process process) Supports adding a process into an existing run. The result of this will depend on whether the existing run is part of a chained process or not. In a chained process the new process will be added to the end of the chain. if the existing process was not a chained version, but a single call then this will result in a new single process run after the current one. a new parent process run will not be created and so on. See fferpcore.ffasync_ProcessService.AddProcess class for an fferpcore.ffasync_IAction that can be returned by a process that will handle calling this. Input Parameters
addProcessglobal static void addProcess(fferpcore.ffasync_ProcessService.ProcessExecutionContext ctxt, fferpcore.ffasync_ProcessIterable process) Input Parameters
startProcessglobal static Id startProcess(fferpcore.ffasync_Process process) Supports single process jobs. Input Parameters
Return ValueProcessRun ID of the Process Run Record 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. fferpcore.ffasync_Process p = new SampleProcess(); fferpcore.ffasync_ProcessService.startProcess(p); //works for single Process Run startProcessglobal static Id startProcess(fferpcore.ffasync_ProcessIterable process) Input Parameters
Return ValueProcessRun ID of the Process Run Record startChainedProcessesglobal static Id startChainedProcesses(fferpcore.ffasync_ChainedProcess cProcess) Supports multiple processes. The processes supplied in the list are chained together and run in sequence. Input Parameters
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. fferpcore.Process p = new SampleProcess(); String parentDescription = 'Background Posting'; List<fferpcore.ffasync_IAction> actions = new List<fferpcore.ffasync_IAction>{new CustomAction()};// CustomAction will implement ffasync_IAction interface fferpcore.ffasync_ChainedProcess cProcess = new fferpcore.ffasync_ChainedProcess(new List<fferpcore.ffasync_Process>{p}, parentDescription, actions); fferpcore.ffasync_ProcessService.startChainedProcesses(cProcess); fferpcore.ffasync_ProcessService.ProcessResponseglobal inherited sharing class ProcessResponse The service class used to handle responses from Process. The results of records in each Process Run are held in RecordStatus, and the list used to build a single response object for each Process Run. 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. Id recordId; //Id of the record to be run in Process e.g. worker item in Background Posting Boolean isSuccessful = true; //false if processing failed. Id relatedRecordId; //Id of the related record of running record e.g. Sales Invoice String message = 'success'; // Message to identify success or failure of record. fferpcore.ffasync_ProcessService.RecordStatus recordStatus = new fferpcore.ffasync_ProcessService.RecordStatus(recordId, isSuccessful, relatedRecordId, message); List<fferpcore.ffasync_ProcessService.RecordStatus> recordStatuses = new List<fferpcore.ffasync_ProcessService.RecordStatus>{recordStatus}; fferpcore.ffasync_ProcessService.ProcessResponse response = new fferpcore.ffasync_ProcessService.ProcessResponse(recordStatuses); Methods
ProcessResponseglobal ProcessResponse() ProcessResponseglobal ProcessResponse(List<fferpcore.ffasync_ProcessService.RecordStatus> recordStatuses) Input Parameters
fferpcore.ffasync_ProcessService.RecordStatusglobal inherited sharing class RecordStatus Holds information on the Status of each record in the Process Run Methods
RecordStatusglobal RecordStatus(Id recordId, Boolean isSuccessful, Id relatedRecordId, String message) Input Parameters
RecordStatusglobal RecordStatus(Id recordId, Boolean isSuccessful) Input Parameters
fferpcore.ffasync_ProcessService.IProcessResultglobal Interface IProcessResult The runAction method of fferpcore.ffasync_IAction uses this class as input. This class provides information on the results of Process Runs, such as the number of records with Error, Success or Pending status, and the Process Run ID. 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. public class CustomAction implements fferpcore.ffasync_IAction { public void runAction(fferpcore.ffasync_ProcessService.ProcessExecutionContext ctxt, fferpcore.ffasync_ProcessService.IProcessResult processResult) { System.debug(result.getErrorCount()); } } Methods
getErrorCountInteger getErrorCount() Return ValueCount of error records associated with specified Process Run getSuccessCountInteger getSuccessCount() Return ValueCount of success records associated with specified Process Run getPendingCountInteger getPendingCount() Return ValueCount of pending records associated with specified Process Run getTotalCountInteger getTotalCount() Return ValueCount of total records associated with specified Process Run getUserGroupsList<ProcessUserGroup__c> getUserGroups() Return ValueList of Process User Groups associated with specified Process Run useDetailedMonitoringBoolean useDetailedMonitoring() Return ValueReturns true if Process ran in detailed monitoring or not fferpcore.ffasync_ProcessService.NotificationDataglobal inherited sharing class NotificationData The class used for input data to the different Notification types, such as Task, Chatter and Email. Methods
NotificationDataglobal NotificationData(Set<Id> recipientUserIds, String appName) Input Parameters
NotificationDataglobal NotificationData(Set<Id> recipientUserIds) Input Parameters
getAppNameglobal String getAppName() Return ValueAppName Application Name to be given in all Notification. getRecipientUserIdsglobal Set<Id> getRecipientUserIds() Return ValueList of IDs of Users who are supposed to receive Notification. fferpcore.ffasync_ProcessService.AddProcessglobal inherited sharing class AddProcess implements ffasync_IAction Class to be used if user wants to introduce any dynamic process as an action in the end of some process. this as an action at the end of a process will handle everything to do with adding a process dynamically. ffasync_ProcessService.addProcess(ffasync_ProcessService.ProcessExecutionContext ctxt, fferpcore.ffasync_IProcess process) will not be needed when using this. This class implements the following interfaces: Methods
AddProcessglobal AddProcess(fferpcore.ffasync_Process process) Input Parameters
AddProcessglobal AddProcess(fferpcore.ffasync_ProcessIterable process) fferpcore.ffasync_ProcessService.ProcessExecutionContextglobal inherited sharing class ProcessExecutionContext This class contains information that needs to be passed around the system, and can be passed back into the service by custom implementations mid process. MethodsgetParentRunIdglobal Id getParentRunId() Return ValueID of the parent ProcessRun__c for the current process. NB this may be null if there isn't one. getRecordIdsDeprecated: It has been marked deprecated and throws an exception. global List<Id> getRecordIds() Return ValueRecordIDs List of IDs of record executing in this chunk. fferpcore.ffasync_ProcessService.ICallbackglobal interface ICallback Methodsrunvoid run(Object response) |