Tuesday 11 November 2014

Standard controller with Extension

Like other Apex classes, controller extensions run in system mode. Consequently, the current user's credentials are not used to execute controller logic, and the user's permissions and field-level security do not apply. However, 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 permissions, field-level security, and sharing rules of the current user apply.

You can choose whether a controller extension respects a user's organization-wide defaults, role hierarchy, and sharing rules by using the with sharing keywords in the class definition.

controller extension is any Apex class containing a constructor that takes a single argument of type ApexPages.StandardController or CustomControllerName, where CustomControllerName is the name of a custom controller you want to extend.



            The value of the <apex:outputText> component renders as varam. Overrides are defined by whichever methods are defined in the “leftmost” extension, or, the extension that is first in the comma-separated list. Thus, the Prasad  method of ExtOne is overriding the method of ExtTwo..

<apex:page standardController="Account" extensions="exte1,exte2"  sidebar="false">
    <apex:form >
    <apex:outputText value="{!prasad}"></apex:outputText>
    </apex:form>
</apex:page>

public class exte1 {

    public exte1(ApexPages.StandardController controller) {

    }
    public string getprasad(){
    return 'varam';
    }

}

public class exte2 {

    public exte1(ApexPages.StandardController controller) {

    }
    public string getprasad(){
    return 'varam1';
    }

}


No comments:

Post a Comment

Complete Salesforce CPQ training Free videos

Salesforcestart:: We are excited to announce that our YouTube channel, Salesforcestart, is your one-stop-shop for all things Salesforce CPQ!...