+ Start a Discussion
Devendra Hirulkar 3Devendra Hirulkar 3 

who to copy child field data to parent field using trigger

i have two object  child(class) and parent(student) 
 
student         class
----------------------------
name           name
address        student(lookup)
rollno          rollno
------------------------------
in above to obj if student name and class name will match  then it copy rollno from class and put into student 
please tell me how to get this 
thanks,
devendra
Brian FordBrian Ford
' in above to obj if student name and class name will match  then it copy rollno from class and put into student '

Not sure I understand what you're trying to do. Do you want to copy the value from Class__r.RollNo__c to Student__r.RollNo__c? Since this is a Many-to-1 relationship, how would you chose which Class to pull the rollno value from?

You could write a trigger that says if any of the related Class records have X value for rollno then make rollno Y on the Student record.
Devendra Hirulkar 3Devendra Hirulkar 3
sir i want only if both the class name and student name is match then only the rollno of class is copy and put into the student rollno 
sir please tell me the trigger to do this 
thanks sir
devendra