+ Start a Discussion
mohimohi 

why we use controler extension class plz specyfy:

As I m new to the sf

i know how to use controler extension but don't know whyyyyyyyy

plz help

Thanks

Ispita_NavatarIspita_Navatar

A controller extension is an Apex class that extends the functionality of a standard or custom controller.

Say you want all the standard functions of account plus you want some more added functionality so what you do in your page - user "Account" as controller and for extensions use "MyExtensionClass" in which you code the extra functionality.

 

So use it when:-

•You want to leverage the built-in functionality of a standard controller but override one or more actions, such as edit, view,
save, or delete. {Want to preserve all standard functionality as if you write your own custom controller all the existing function of an object need to be coded which is cumbersome and is like reinventing the wheel}
• You want to add new actions. {Say for Account you want an} added functionality find Duplicates so you will add that in extension class}
• You want to build a Visualforce page that respects user permissions. Although a controller extension class executes in system mode, if a controller extension extends a standard controller, the logic from the standard controller does not execute in system mode. Instead, it executes in user mode, in which the profile-based permissions, field-level security, and sharing rules of the current user apply. {In case you want want your page to execute in user mode as against system mode which happens in normal visual force page system mode does not respect profile wide and other field level restrictions }

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.