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
Vidya H 4Vidya H 4 

Need to Create a replica of a record in Custom Object named "B", when ever a record is updated for the first time(only first time), in a custom Object named "A". Create necessary relation between the objects to achieve the desired result.

CharuDuttCharuDutt
Hiii Vidya
Try Below Code
Make A CheckBox Field In Object_A__c Named IsUpdate For First Time Update Only
trigger acctTrigger on  Object_A__c (after update){
    list<Object_B__c > lstCon = new list<Object_B__c >();
        for(Object_A__c Acc : trigger.new){
            if(!Acc.IsUpdated__c){
                Acc.IsUpdated__c = true;
                Object_B__c Con = new Object_B__c ();
                Con.LastName = 'Test Contact';
                Con.AccountId = Acc.Id;
                lstCon.add(Con);
            }
        }
    if(lstCon.size()>0){
    insert lstCon;
    }
}
Pleae Mark It As Best Answer If It Helps
Thank You!
Vidya H 4Vidya H 4
@CharuDutt     without checkbox can we do?
CharuDuttCharuDutt
No How Do You Track Then If The Record is Updated For First Time Only Without CheckBox