0

I have a master-detail relationship with master object Service__c and child object Service_Task__c. The relationship API is Service_Task__r. I am using a custom controller.

My visualforce page is displaying a list of Service_Task__c. However, for each Service_Task__c, I want to show a variable from the master object Service__c which is Description__c. How do i access the variable Description__c and display it?

serviceTaskList = [SELECT Name, Service__c FROM Service_Task__c}

I have tried this and it shows the Service__c ID. Service__c.Description__c does not work.

0

You use the "relationship" to get the parent record. For standard fields, this is the name of the field minus the Id (e.g. to get the account name on a contact, Account.Name), and for custom fields, as in your example, you change __c to __r (e.g. Service__r.Description__c).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.