You need to sign in to do that
Don't have an account?
Krishan Gopal 27
how to validate on relationship field using trigger
facing trouble to one object to to another in trigger to solve that query
in this queston candidate object have a lookup field to select job and according to job object field active status . candidate shold able to select .
how to write query to check from old job data to a new candidate
- If Candidate is applying for a job whose status is Not Active(deactivate job). He should get an error, “This Job is not active. You can not apply for this job.
in this queston candidate object have a lookup field to select job and according to job object field active status . candidate shold able to select .
how to write query to check from old job data to a new candidate
If Active__c field is Checkbok in Jobs object then use the below code:
Thanks,
Maharajan.C
All Answers
Try Below Code Please Mark It As Best Answer If It Helps
Thank You!
You can't access the parent objects details from trigger.New. Trigger.New will holds only the current record details.
Try the below code:
Thanks,
Maharajan.C
Please Copy and Paste below code and Check this.
trigger ActiveCheck on Candidate__c(before insert){
for(Candidate__c cb : trigger.new){
if(cb.Job__c != null && cb.Job__r.Active__c == false){
cb.AddError('This Job is not Active You cannot apply for this job');
}
}
}
Thanks
If Active__c field is Checkbok in Jobs object then use the below code:
Thanks,
Maharajan.C