
- Salesforce Tutorial
- Salesforce - Home
- Salesforce - Overview
- Salesforce - Architecture
- Salesforce - Environment
- Salesforce - Sales Cloud
- Salesforce - Service Cloud
- Salesforce - Navigating Setup
- Salesforce Objects
- Salesforce - Standard Objects
- Salesforce - Custom Objects
- Salesforce - Master Detail
- Salesforce - Lookup Relationship
- Salesforce - Schema Builder
- Data Security
- Salesforce - Control Access Org
- Salesforce - Control Access Objects
- Salesforce - Control Access Fields
- Salesforce - Control Access Records
- Salesforce - Create a Role Hierarchy
- Salesforce - Define Sharing Rules
- Process Builder
- Automate Business Processes
- Salesforce - Importing Data
- Salesforce - Exporting Data
- Salesforce - Reports
- Salesforce - Dashboards
- Salesforce - Using Formula Fields
- Visualforce
- Salesforce - Visualforce Pages
- Salesforce - Variables & Formulas
- Salesforce - Standard Controllers
- Salesforce - Records, Fields & Tables
- Salesforce - Using Forms
- Salesforce - List Controllers
- Salesforce - Static Resources
- Salesforce Useful Resources
- Salesforce - Quick Guide
- Salesforce - Useful Resources
- Salesforce - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Salesforce - Records, Fields and Tables
We have already seen how to get the values of a record using the standard controller. But we can also display the field values in a more formatted way by using additional controllers.
In this chapter, we will see how to display the fields of an object and the data of a details table in a Master-detail relation.
Display Fields
When we want to display the fields of a record in a formatted manner with column headers, rather than just the labels and values, we can use the OutputField option. The code given below shows the apex program to display the filled data from Contact. As you can see, we do not need the labels to be in place to indicate the field values.
To preview the result of the above code, we use the ID of the record as described in the previous chapter. The result shows the following output showing the field values of the records along with column headers.
Display Tables
We can display all the records of a details table by taking a value from a master table. For example, we can display all the contacts associated with an account. In such case, we use the iteration component which in our case is the contacts table linked to account. Below is the code to display all the contacts associated with the Account table.
On previewing the output form the above code, we get the following result.