You need to sign in to do that
Don't have an account?
Kishan Kumar 77
I need to write a trigger that rejects double assignment of teachers.
I have an object as teacher_student__c .Whenever a student is linked to a teacher, check whether the student already has a teacher with same subject assigned to him/her and if already exists, then throw an error 'A teacher is already assigned to this student for the subject.
Could you elaborate the scenario along with background details to check further and also it would be helpful if you could give an example to the scenario.
Looking forward for your response.
Regards,
Anutej
Basically I have 3 objects. Student__c, Teacher__c and Teacher_Student__c where the third object is the junction object. Now I need to write a trigger where Teacher_Student__c is the sObject. Now the condition is as I've mentioned above Whenever a student is linked to a teacher, check whether the student already has a teacher with same subject assigned to him/her and if already exists, then throw an error 'A teacher is already assigned to this student for the subject.