I am trying to update contact record field through Student custom object that once in Student object active field is checked than the active field in contact for that record should also be checked. I have made a lookup of contact in Student and I have tried a trigger but it is not working.
trigger is like------
trigger updateRecordOnContact on Student__c (after insert)
{
List<Student__c> updateRecord = Trigger.new;
updateRecord = [SELECT Id,Active__c FROM Student__c];
for(Student__c updateAct:updateRecord)
{
if(updateAct.Active__c == true)
{
List<Contact> conn = [SELECT Id,Active__c FROM Contact WHERE Id=:updateAct.Id];
for(Contact con:conn)
{
con.Active__c = true;
}
Update conn;
}
}
}
please help for this......