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
HARISH S 11HARISH S 11 

To create a custom object 'copy account' and whenever the account is inserted/updated automatically 'Copy account' object also should be inserted/updated/

Hello am bit new to salesforce, can somebody help me with this?


Public class Accountcopycheck{
        Set <Id> accid = new Set<Id>();
    Public static void Accountcopymethod(List <Account_copy__c> acccpy){
        for(Account a :acccpy){
            if(acccpy.AccountcopyId != null){
            accid.add(a.AccountId);
        }
        }
    List<Account> listacc = [ Select id, name, phone, website from Account where id IN:accid];
        if(listacc.size()>0){
        for(Account ab:listacc){
            for(Account_copy__c acopy:ab.acccpy){
                acopy.Account__c=ab.Name;
                acopy.Phone__c=ab.phone;
                acopy.Website__c=ab.phone;
    }
    }
   }