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
pelmiapelmia 

Custom or extended controller for standard page?

Is it possible to keep the standard page but extend or customize the standard controller? How would this be done?

 

The question is in general to learn to develop in force. The practical problem I'm facing right now is to set a default value to a a field relating to the user object.

hisrinuhisrinu

Here is the code.

 

 

<apex:page standardcontroller = "Account" extension="myextn">
<apex:form>
<apex:pageblock>
<apex:pageblocksection>
<apex:inputfield value="{!Account.Name}"/>
</apex:pageblocksection>
</apex:pageblock>
</apex:form>
</apex:page>


Public class myextn{
Public myextn(Apexpage.standardcontroller cnt){
  account a = (Account)cnt.getRecord();
  a.Name = 'DEFAULT VALUE';
}
}

 

 

vinicius.paivavinicius.paiva

Hi Hisrinu,

 

  The code snipet you provided is not appliable for a standard page (E.g. The edit page for the "Job Applications" example provided in the fundamentals tutorial).

  Is it possible to use a extension controller to a standard page?

 

Thanks in advance