Sunday 6 December 2020

Sample code on how to execute GroupAssignmentBatchable Finserv (FSC) apex Job (Salesforce )


Record rollup batch job execution

GroupAssignmentBatchable 

Option 1

To execute the job for all objects with configuration defined in the custom setting use the following signature.
Database.executeBatch(new FinServ.GroupAssignmentBatchable());

Option 2

To execute the job for one or more objects with overridden settings, New instances of class FinServ.GroupAssignmentBatchable.RecordRollupConfig need to be constructed and passed to FinServ.GroupAssignmentBatchable.runRecordRollupJob(List<FinServ.GroupAssignmentBatchable.RecordRollupConfig> recordRollupConfigs).

FinServ.GroupAssignmentBatchable.RecordRollupConfig provides two constructors:

//startTime, endTime and scope can be set to null.
//When set to null value the values are read from the custom setting.

//Constructor 1:
RecordRollupConfig(String objectName, Datetime startTime, Datetime endTime)


//Constructor 2
RecordRollupConfig(String objectName, Datetime startTime, Datetime endTime, Integer scope)

Sample code:

FinServ.GroupAssignmentBatchable.RecordRollupConfig recordRollupConfigFinancialAccount =new FinServ.GroupAssignmentBatchable.RecordRollupConfig('FinancialAccount__c', DateTime.newInstance(2009, 3, 4, 21, 2, 2), null, 500);

FinServ.GroupAssignmentBatchable.RecordRollupConfig recordRollupConfigCase =new FinServ.GroupAssignmentBatchable.RecordRollupConfig('Case', null, null, null);

List<FinServ.GroupAssignmentBatchable.RecordRollupConfig> recordRollupConfigs = new List<FinServ.GroupAssignmentBatchable.RecordRollupConfig>{recordRollupConfigFinancialAccount, recordRollupConfigCase};


FinServ.GroupAssignmentBatchable.runRecordRollupJob(recordRollupConfigs);




No comments:

Post a Comment

How to generate QR code for Survey Invitation in Salesforce Platform Survey

 Easy steps to generate QR code for Survey Invitation Link 1) Create your Survey using Salesforce Platform Survey. 2) Once done activate it....