+ Start a Discussion
BobBob 

Visual Force Fields

Can I call out to a field like a cross object formula field can? If I have a case page and I want to pull information from a object related to the case. Is this possible?
Divya GoelDivya Goel

If you want to pull the information related to case you have to write the follwing code in controller

 

public Case case {get; set;}

 

in constructor of the class write follwing code:

 

public <Your className>(ApexPages.StandardController stdController) {

this.case= [Select c.Account.Website, c.Account.Type, c.Account.Name, c.AccountId From Case c  where Id=:stdController.getId()];

 

and on your VF page use "{!case.Account.Name}"

 

I think this will help you. If you face any issue please let me know.

 

jeffdonthemic2jeffdonthemic2

This blog post might help you out as it describes both parent and child relationships.

Using Relationships In Visualforce Pages

Jeff Douglas
Appirio, Inc.
http://blog.jeffdouglas.com

BobBob
Forgive me I'm new  at this, but where would I put the public Case case {get; set;} and the 

public <Your className>(ApexPages.StandardController stdController) {

this.case= [Select c.Account.Website, c.Account.Type, c.Account.Name, c.AccountId From Case c  where Id=:stdController.getId()]; 

 

In my example below. I also want to use a custom object called Unit__c. on my case page the lookup field is the serial number__c field.

<apex:page standardController="Case" > <apex:form ><apex:pageBlock ><apexpageBlockSelection title="Update Install Information"> <apex:inputField value="{!Case.Serial_Number__c}"/><apex:inputField value="{!Case.Travel_Hours__c}"/><apex:inputField value="{!Case.Labor_Hours__c}"/><apex:commandButton action="{!save}"value="Update"/></apexpageBlockSelection></apex:pageBlock></apex:form><apex:detail relatedList="false" /><apex:relatedList list="Tech_Queue__r"/><apex:relatedList list="Parts__r"/></apex:page>
BobBob

Okay something easier, how do i get this {!Case.Serial_Number__r.Install_Date__c} to point to a specific record that is on the case.

 

the serial number field is a lookup field and the child of the case. I wantto update the date of install from the case page to the serial number object.

jeffdonthemic2jeffdonthemic2
So are you trying to display data in a Visualforce page or create a form so that you can update data?
BobBob

I'm trying to create a visual force case page with added fields from another custom object call "Unit" so a customer service rep can update the install date and customer who owns the piece of equipment from the case page.