You need to sign in to do that
Don't have an account?
TheCustomCloud
Simple Trigger
Why doesnt this trigger work? It doesnt throw any errors it just doesnt populate the title field. Can I not use a reference like Contact__r.Contacts_Title__c in a trigger?
trigger AddTitleToAttendee_BI on Attendee__c (Before Insert) {
for(Attendee__c a : trigger.new){
a.Title__c = a.Contact__r.Contacts_Title__c;
}
}
You trigger should be like this
In trigger.new , trigger.old or trigger.newMap , trigger.oldMap all contain current object fields only not related object values, please use above trigger . let me know if any issue in it.
All Answers
Unfortunately you can't - you will only have the direct fields for the records you are processing. If you wish to follow relationships you will have to query the related objects via SOQL.
You trigger should be like this
In trigger.new , trigger.old or trigger.newMap , trigger.oldMap all contain current object fields only not related object values, please use above trigger . let me know if any issue in it.
Smart solution Shashikant Sharma. My solution was similar but from looking at yours I realized I may accidently associate a contact to the wrong title if more the attendee is referencing the same contact.