function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shiv ShankarShiv Shankar 

In what scinario i should use visuforce components ?

Hi All,

 

Please give me a fine knowledge on  visuforce components. How i come to that , this is the best time to use apex:component. Let me know when you generally use apex:componet.

 

Thaks

Best Answer chosen by Admin (Salesforce Developers) 
Shiva Ramesh @ xcdhrShiva Ramesh @ xcdhr

Hi Shiv Shankar

 

For ex: if you want to display same table data or pageblock section for two or more times in a visualforce page or mulitiple pages you can use visualforce component. It will act like code resuability.

 

Another scenario is:

1) In visualforce email template if you want to use same email template for multi-language like English,Spanish, or French then component is a best way to make it.

 

2) Create different component for each language and call the components in visualforce email template and rendered it based on user country.

All Answers

Deepa.B.AnkaliDeepa.B.Ankali

@Shiv Shankar,

 

Components can be used when you think the same functionality can be used elsewhere in other pages. As classes can have utility classes, pages can use components. They are nothing but for generic usage.

Shiva Ramesh @ xcdhrShiva Ramesh @ xcdhr

Hi Shiv Shankar

 

For ex: if you want to display same table data or pageblock section for two or more times in a visualforce page or mulitiple pages you can use visualforce component. It will act like code resuability.

 

Another scenario is:

1) In visualforce email template if you want to use same email template for multi-language like English,Spanish, or French then component is a best way to make it.

 

2) Create different component for each language and call the components in visualforce email template and rendered it based on user country.

This was selected as the best answer