function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Prashant GulvePrashant Gulve 

Create 2 custom fields on account : 1. Contact Last updated ( date time ) 2. Contact Updating count ( number ) When ever a child contact record is updated, update the date/time field “Contact Last updated” field on parent account, also increment the cou

Create two custom fields on account :
1. Contact Last updated ( date time )
2. Contact Updating  count ( number )
When ever a child contact record is updated, update the date/time field “Contact Last updated” field on parent account, also increment the counter field “Updating  count” with plus one. So that if the child contact record is updated 3 times the counter field “Updating  count” will have the value 3, and the “Contact Last updated” will have the value of the date/time it was last updated.
Suraj Tripathi 47Suraj Tripathi 47
Hi Prashant
Here is the solution:
Trigger:
trigger Contacttrigger on Contact (after update) {
if(trigger.isAfter && trigger.isupdate){
        Updatecontact.Updatecontactaccount(trigger.new);
    }
}
Apex Class:
public class Updatecontact {
    public static void Updatecontactaccount(List<contact> contactlist){
        Set<Id> accountIdset = new set<ID>();
        for(Contact con:contactlist){
            accountIdset.add(con.AccountId);
        }
        List<Account> acclist = new List<account>();
        acclist = [select Id,Contact_Last_Updated__c,Contact_updating_count__c,Name from account where Id IN:accountIdset];
        for(Account acc:acclist){
            acc.Contact_Last_Updated__c = Datetime.now();
            if(acc.Contact_updating_count__c !=null){
            acc.Contact_updating_count__c = acc.Contact_updating_count__c+1;
            }
            else{
                 acc.Contact_updating_count__c= 1;
            }
        }
        update acclist;
        
    }

}
gfdbhg gvfdgfgfdbhg gvfdgf
I think your custom field accounts need more reliability just like (https://gbhouse.info) did in there fields I will suggest you to do it right from the first step.