You need to sign in to do that
Don't have an account?
Ian Gendreau
Reference Master Field Values from VF Page with Custom Object Controller
New to VF here...
I have a custom object named Materials__c. It has a Master/Detail relationship with Opportunity, so any one Opportunity can have multiple Materials__c objects. On my VF page, I can reference fields from Materials__c easily by using {!Materials__c.FieldName} because I'm using standardController="Materials__c". Two questions:
1. How do I reference things on the Master object? Like how do I reference Opportunity.Amount or Opportunity.Stage?
2. Taking it a step further, how do I reference fields from Objects the Master is related to? Like can I reference fields on the Account page of the Account that the Opportunity is tied to from a VF page that has a standarController of Materials__C?
I have a custom object named Materials__c. It has a Master/Detail relationship with Opportunity, so any one Opportunity can have multiple Materials__c objects. On my VF page, I can reference fields from Materials__c easily by using {!Materials__c.FieldName} because I'm using standardController="Materials__c". Two questions:
1. How do I reference things on the Master object? Like how do I reference Opportunity.Amount or Opportunity.Stage?
2. Taking it a step further, how do I reference fields from Objects the Master is related to? Like can I reference fields on the Account page of the Account that the Opportunity is tied to from a VF page that has a standarController of Materials__C?
- You'll have to query the parent object inside of your controller using SOQL and expose the parent as a variable
- Same as 1, you'll have to query them in your controller.
Let me know if you need more explaination or an example