+ Start a Discussion
Raghav Sharma 39Raghav Sharma 39 

how can we do rollup summary to count the number of contacts on account by using workflow/process builder?

Deepali KulshresthaDeepali Kulshrestha
Hi Raghav,
Please go through the link below.

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha
Saransh BSaransh B
Process builder will be helpful in this case but not a workflow but I would suggest trigger because even though Salesforce mentioned that process builder is bulkified, It doesn't work same way everytime if more than 200 records are there.
Hi Raghav,

please check with the Trigger handler class,
public class CountContact {
    public static void countContactOnAccount(List<Contact> conList) {
       set<id> idset = new set<id>();
        for(Contact conObj : conList) {
        List<Contact> countConList = [SELECT Id From Contact where Accountid =:idset];
        integer countCon = countConList.size();
        List<Account> accList = [SELECT Id,NumberOfEmployees From Account where id =:idset];
        List<Account> uppAccList = new List<Account>();
        for(Account accObj:accList) {
            accObj.NumberOfEmployees = countCon;
        update uppAccList;
Contact trigger,

trigger ContactTrigger on Contact (After insert) {

Try this and let us know..........