Thursday, 16 November 2017

Retrieving Fields When a Lookup is Performed EX03_07

When viewing an sObject that has a lookup relationship to another sObject, additional fields from the related sObject can be displayed on the page using formula fields. When creating a new record, or editing an existing record and changing the lookup value, formula fields cannot be used, as the lookup field has only been populated with a record ID and the related record has not been retrieved.

Extension Controller

Name: EX03_07RetLookupFieldsExt


VisualForce Page


Name: EX03_07RetLookupFields


Display 1


Display 2


Populating the account lookup automatically populates the Website and Phone output elements with the details from the account: