Salesforce Records, Fields and Tables - Salesforce

What are Salesforce Records, Fields and Tables?

We have previously seen how to get the values of a record by means of the standard controller. But we can also show the field values in a further formatted way by means of additional controllers.

In this chapter, we will see how to show the fields of an object and the data of a particular table in a Master-detail relation.

Display Fields

When we need to show the fields of a record in a arranged manner with column headers, rather than just the labels and values, we can use the OutputField choice. The code given below shows the apex program to show the filled data from Contact. As you can see, we do not want the labels to be in place to specify the field values.

vf_s_record_fields_tables_code

To show the result of the above code, we use the ID of the record as defined in the previous chapter. The result shows the resulting output viewing the field values of the records along with column headers.

vf_s_record_fields_tables1

Display Tables

We can show all the records of a details table by taking a value from a master table. For instance, we can show all the contacts related with an account. In such case, we use the iteration component which in our case is the contacts table linked to account. Underneath is the code to show all the contacts related with the Account table.

vf_s_record_table_code

On previewing the output form the above code, we get the resulting result.

vf_s_record_table_result

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Salesforce Topics