Flow – Create Rollup summary to calculate the Contacts associated with Accounts

Scenario : This is sample Usecase

Step 1: Create an Apex class named

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Step 2: Create an Apex class named

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Step 3: Add Your Heading Text Here

				
					global class accountBatchFailuresSync implements Database.Batchable<sObject>, Database.AllowsCallouts {
	
	public String query = 'Select Id, Name, Industry, Number_of_opps__c, LastModifiedDate, CreatedDate, LastModifiedBy.Id from Account where Industry != null AND Do_Not_Sync__c = false AND ((Number_of_opps__c > 0 OR Admin_Id__c != null) AND Synced__c = false)';

	global Database.QueryLocator start(Database.BatchableContext BC) {
		return Database.getQueryLocator(query);
	}

	global void execute(Database.BatchableContext BC, List<Account> records) {        

		Set<String> acts = new Set<String>();
		for (Account act: records) {
			acts.add(string.ValueOf(act.Id));
		}

		if(accountSyncAPIrecursion.isFirstTime) {
			accountSyncAPI.startBatchFailureSync(acts);
		}

	}

	global void finish(Database.BatchableContext BC){   

	}
	
}
				
			

Video

References