You need to sign in to do that
Don't have an account?
shweta kumari 25
custom object relationship
I have custom object relationship as follows:
Course__c is a Master-Detail to Course_Delivery__c ; so Course__c is a Master and Course_Delivery__c is child object
Course_Attendee__c is a Master-detail to Course_Delivery__c ; so Course_Attendee__c is a Master and Course_Delivery__c is child object.
Course__c has fields like : location , startdate , instructor
records exists on all custom objects.
I have written a upward traversal soql as follows:
List<Course_Delivery__c> lsCourse_delivery=[select ID,
Instructor__c,
Start_Date__c,
Course_Delivery__c.Course_Attendee__r.InstructorNotes__c,
Course_Delivery__c.Course__r.Name
from
Course_Delivery__c
Order By Location__c];
system.debug(lsCourse_delivery);
I am getting an error as : Course_Delivery__c.Course_Attendee__r.InstructorNotes__c ^ ERROR at Row:4:Column:45 Didn't understand relationship 'Course_Attendee__r' in field path.
Please help me
shweta
Course__c is a Master-Detail to Course_Delivery__c ; so Course__c is a Master and Course_Delivery__c is child object
Course_Attendee__c is a Master-detail to Course_Delivery__c ; so Course_Attendee__c is a Master and Course_Delivery__c is child object.
Course__c has fields like : location , startdate , instructor
records exists on all custom objects.
I have written a upward traversal soql as follows:
List<Course_Delivery__c> lsCourse_delivery=[select ID,
Instructor__c,
Start_Date__c,
Course_Delivery__c.Course_Attendee__r.InstructorNotes__c,
Course_Delivery__c.Course__r.Name
from
Course_Delivery__c
Order By Location__c];
system.debug(lsCourse_delivery);
I am getting an error as : Course_Delivery__c.Course_Attendee__r.InstructorNotes__c ^ ERROR at Row:4:Column:45 Didn't understand relationship 'Course_Attendee__r' in field path.
Please help me
shweta
Please make sure that API name of the 'Course Attendee' master detils field in the 'Course Delivery' object is 'Course_Attendee__c'.
If not, please use the exact API with replacing __c with __r.
regards
Sampath
Let me give more clear picture.
In course_delivery__c : Under Custom Fields & Relationships ; I have as follows
Attendee Count Attendee_Count__c Roll-Up Summary (COUNT Course Attendee)
In Course_Attendee__c : Under Custom Fields & Relationships ; I have as follows
Course Delivery Course_Delivery__c Master-Detail(Course Delivery)
But the query I posted throws error, I missing something?
shweta
I'm little bit confused. Initially you have mentioned that,
Course__c is a Master-Detail to Course_Delivery__c and Course_Attendee__c is a Master-detail to Course_Delivery__c
then Course__c and Course_Attendee__c should be parents and Course_Delivery__c should be the child.
Then Roll-Up Summary fields should be inside the parents.
It is better if you can share the screens of Custom Fields & Relationships section of each objects.
Hello
I have attached screen shots for each custom object in question.
Course__c
Course_Attendee__c
Course_Delivery__c
You cannot select 'InstructorNotes__c' like Course_Delivery__c.Course_Attendee__r.InstructorNotes__c
because you don't have a lookup or master detail relationship to Course_Attendee__C objetc in Course_Delivery__c.
If you want to get the InstructorNotes__c field also with the fields in Course_Delivery__c I suggest you to write a wrapper class.
regards
Cud u pls show me sample how the wrapper class would be if I were to access the field InstructorNotes__c also from the course_delivery__c object?
shweta
Since one Course_Delivery__c can have linked with many Course_Attendee__c, when you select fields from Course_Delivery__c, you may get many Course_Attendee__c(InstructorNotes__c) records for a given Course_Delivery__c record. So please let me know how you are going to use this records for VF page or some where else?
yes, vf page to display records of course_delivery__c and also instructornotes__c
You can try like below,
You can access the 'courseWrapperList' inside the VF page and need it to itterate.
regards
Sampath