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
Amruta ChaudharyAmruta Chaudhary 

How to copy field data from child object to parent object ?

Hii Amruta
Try Below Trigger
trigger Contacttrigger on Contact (After Insert) {
    Set<Id> setAccIds = new Set<Id>();
        for(Contact con :{
            if(con.AccountId != null){
    for(Account acc :[Select id,Description ,(Select id,name from contacts) from Account where Id in : setAccIds]){
      String s ='';
        for(Contact Con :acc.contacts){
            s+=Con.Name +',';  
        acc.Description =  s.removeEnd(',');
        update accList;     
Please Mark It As Best Answer If It Helps
Thank You! 
Amruta ChaudharyAmruta Chaudhary
i want copy data from quote(child) object to Opportunity (parent) object 

Quote       Opportunity

number     number 
version    version 
primary field on quote must be checked .
Suraj Tripathi 47Suraj Tripathi 47
Hi Amruta,

please try this approach 
list<quote__c> quoteList = [select id,opportunityId,number__c,version__c from quote__c where opportunityId !=              null];
 set<id> oppIdSet = new set<id>();

for(quote__c quoteObj :quoteList ){
    oppIdSet.add(quoteObj.opportunityId );  

map<id,opportunity> oppmap = new map<id,Opportunity>( [select 
 id , number__c , version__c from Opportunity where id In: oppIdset]);

for(quote__c quoteObj :quoteList ){

      opportunity oppObj = oppmap.get(quoteObj.opportunityId);
      oppObj.number__c  = quoteObj.number__c  ;
      oppObj.version__c  = quoteObj.version__c  ;

      oppmap.put(quoteObj.opportunityId,oppObj );
update oppmap.values();

 If you find your Solution then mark this as the best answer.

Thank you!
Suraj Tripathi