+ Start a Discussion
dreamrealdreamreal 

Data from Related Objects

I want to create a visualforce page which displays some data. 

 

The standard controller is Phone Line, a custom object.

 

Each opportunity has multiple phone lines. In each phone line there is a lookup field to the opportunity it is related to.

 

I want to be able to display data from the opportunity that the current phone line is related to.

 

For example, from a particular phone line record, the user should click a button to get to the visualforce page which should display information about the opportunity the phone line is related to.

 

I'm very new to this, and from my limited understanding, I believe that I would have to either write a custom controller, or an extension in apex. Your help would be appreciated

Best Answer chosen by Admin (Salesforce Developers) 
imuino2imuino2

I think you should be able to use the standard controller to do that.

Try to just print the Opportunity Id on your page, once you got that you only need to make a commandLink.

To do this try by doing the following lets say you have pLine a Phone Line object.

pLine.Opportunity__r.Id

or

pLine.OpportunityId__r

It depends on how it is on your Schema.

Check the Schema on Phone Line object to see the reference field.

 

Ignacio.

 

 

All Answers

imuino2imuino2

I think you should be able to use the standard controller to do that.

Try to just print the Opportunity Id on your page, once you got that you only need to make a commandLink.

To do this try by doing the following lets say you have pLine a Phone Line object.

pLine.Opportunity__r.Id

or

pLine.OpportunityId__r

It depends on how it is on your Schema.

Check the Schema on Phone Line object to see the reference field.

 

Ignacio.

 

 

This was selected as the best answer
dreamrealdreamreal

Thanks Ignacio!