Friday, March 20, 2015

Standard Controller

Which is similar to that of Salesforce's standard controller. when insert a record into sObject then the page will be redirect to he Detail Page of that record. Which renders the record with the standard controller


Here is the sample code which display record values based on the Record ID using Standard Controller

standardController is an attribute in the page tag which uses to call the sObject for values


<apex:page standardController="Bottle__c" >
  <apex:form >
  <apex:pageBlock >
  <apex:pageBlockButtons >
  <apex:commandButton value="Cancel" action="{!Cancel}" />
  </apex:pageBlockButtons>
 
  <apex:pageBlockSection >
   
  <apex:pageBlockSectionItem >
  <apex:outputText >Bottle Name</apex:outputText>
  <apex:outputField value="{!Bottle__c.Name}" />
  </apex:pageBlockSectionItem>
 
  <apex:pageBlockSectionItem >
  <apex:outputText >Bottle Price</apex:outputText>
  <apex:outputField value="{!Bottle__c.Price__c}" />
  </apex:pageBlockSectionItem>
 
  <apex:pageBlockSectionItem >
  <apex:outputText >Bottle Quantity</apex:outputText>
  <apex:outputField value="{!Bottle__c.Quantity__c}" />
  </apex:pageBlockSectionItem>
 
  <apex:pageBlockSectionItem >
  </apex:pageBlockSectionItem>
  <apex:pageBlockSectionItem >
  </apex:pageBlockSectionItem>
  <apex:pageBlockSectionItem >
  </apex:pageBlockSectionItem>
  <p> To display 1 record after the pageName?id=value<br/>
  <b>Note</b>: id value of the record ex: stdSet_Ctrl?id=value</p>
  </apex:pageBlockSection>
  </apex:pageBlock>
  </apex:form>
</apex:page>



Note : Bottle__c is an Custom sObject, You can use Standard SObject's like Account,Contact,Lead,Opportunity.. etc

0 comments:

Post a Comment

Promotions

Ads

Popular Posts