How to create extension controller for visual force page and get url params
Visualforce Page:
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <apex:page standardController="Account" extensions="CurrentRecordIdDemoController">   <apex:form >     <apex:pageBlock >         <apex:pageBlockSection title="Current account   record Id is : {!currentRecordId}" collapsible="false">             <apex:outputField value="{!acc.name}"/>             <apex:outputField value="{!acc.AccountNumber}"/>             <apex:outputField value="{!acc.Type}"/>             <apex:outputField value="{!acc.Industry}"/>         </apex:pageBlockSection>         <apex:pageBlockSection title="Testing   parameter" collapsible="false">             Name   is <b>{!parameterValue}</b>         </apex:pageBlockSection>     </apex:pageBlock>   </apex:form> </apex:page> | 
Apex Code:
| 1 2 3 4 5 6 7 8 9 10 11 | public class CurrentRecordIdDemoController{ public String currentRecordId   {get;set;} public String parameterValue   {get;set;} public Account acc{get;set;}     public CurrentRecordIdDemoController(ApexPages.StandardController   controller) {         currentRecordId    = ApexPages.CurrentPage().getparameters().get('id');         acc   = [select id ,name, AccountNumber, Type, Industry from  Account where id =: currentRecordId ];         parameterValue   = ApexPages.CurrentPage().getparameters().     } } | 

 
Comments
Post a Comment