You need to sign in to do that
Don't have an account?
Lloyd Ruz
Validation rule for custom objects
I have two custom objects the work in the following way:
ENROLMENTS (Custom) are child objects to COURSES (Custom) and CONTACTS.
I want to make a validation rule that doesn't let users check a checkbox field on a COURSE if a CONTACT who has an ENROLMENT on that course doesn't have an email address. I tried doing this by making an ENROLMENT validation rule (below) but it didn't work (i.e. I was still able to check the box even though there was an enrolment that should have made this impossible).
AND( ISBLANK( Contact__r.Email ), Course__r.Send_Pre_Work__c = TRUE)
Any ideas as to why this didn't work?
ENROLMENTS (Custom) are child objects to COURSES (Custom) and CONTACTS.
I want to make a validation rule that doesn't let users check a checkbox field on a COURSE if a CONTACT who has an ENROLMENT on that course doesn't have an email address. I tried doing this by making an ENROLMENT validation rule (below) but it didn't work (i.e. I was still able to check the box even though there was an enrolment that should have made this impossible).
AND( ISBLANK( Contact__r.Email ), Course__r.Send_Pre_Work__c = TRUE)
Any ideas as to why this didn't work?
If you want a validation on COURSE object , you need to make the validation rule on COURSE object only. if you will create validation rule on ENROLMENT, it wont work. however from your question i understand ENROLMENT is just like a junction object here. so instead of validation rule, you will have to create trigger.
When you are writing validation rule on any object, you can refer its parent record only not the child records. means lets say if there are 2 objects objP(parent) and objC(child) then if you will write the validation rule on objC, you would be able to refer the objP fields but if you will write validation rule on objP,you wont be able to refer objC's fields. Here in your case, if i am not wrong, COURSE is master object of ENROLMENT so you wont refer its fields.