Also when the Contact is deleted, number "1" will be subtracted from the Number_of_Contacts__c field in Accounts.
However here is the issue I am experiencing, when I reassign a contact from one account to another account, the Number_of_Contacts__c field values in the original account does not update.
For example, if I add Contact A to Account A, the Number_of_Contacts__c field = "1" . When I remove Contact A from Account A and add it to Account B, Account A Number_of_Contacts__c field still = "1". It should remain blank.
Is there a way to resolve this issue?
If there is a way to solve this issue without using Apex coding?
If the solution is to use Apex, does anyone have an example of using anApex Trigger and an Apex Class?
4 answers
Hello Forrest,
Here is a solution which will definitely work for you:
https://success.salesforce.com/answers?id=9063A000000e0GiQAI
http://www.dhruvsoft.com/blog/displaying-total-number-of-contacts-for-each-account-in-salesforce/