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
divakar u 9divakar u 9 

when contact is inserted / updated, based the contact's Contact Area field the parents contact Country should change with respected country. wirte a trigger for insert, Update. create required fields.

write trigger on contact to update account field based on contact field
parent object: account
   fields : contact country - Picklist values: India, Africa, America
   child object : contact
   field : Contact Area - Picklist values: Karataka, Andhra Pradesh, Kerala, South Africa, Nigeria, Kenya, California, San Fransisco, Texas

   when contact is inserted / updated, based the contact's Contact Area field the parents contact Country should change with respected country. wirte a trigger for insert, Update.
SandhyaSandhya (Salesforce Developers) 
Hi,

Below is the sample code, you can modify according to your custom fields.
 
trigger updatecontact1 on  Contact (after insert){
    List<contact> lstConUpdate = new List<Contact>();
    set<Id> sAccId = new set<Id>();
    for(Contact con: trigger.new){
        sAccId.add(con.AccountId);
    }
    List<Account> lstAccount = [select id, Address_1__c, (select id,Address_1__c from contacts) from account where id IN: sAccId];
    for(Account acc: lstAccount){
        for(Contact con: acc.contacts){
            con.Address_1__c = acc.Address_1__c;
            lstConUpdate.add(con);
        }
    }
    if(lstConUpdate.size() > 0){
        update lstConUpdate;
    }   
}

Please mark it as solved if my reply was helpful. It will make it available for other as the proper solution.
                                             
Best Regards
Sandhya