• LOGIN
  • No products in the cart.

Controller Extension in Salesforce

Introduction:

In Salesforce, controller extension is called the Apex class containing a constructor, which is used to extend or add the functionalities of a customer controller or standard controller in Salesforce. Also, the extension controller is used in leveraging the functionality of another controller by using custom logic. In Salesforce, controller extensions are used without the custom controller or standard controller.

Controller extension in Salesforce:

In this article, we will learn about Controller Extension in Salesforce and also how to build it. With a simple example, let’s learn about controller extension. This article helps you to learn about building a Salesforce extension controller with Apex class. Apex class containing is a controller extension with a constructor that has a single argument of

SALESFORCE TRAINING

type ApexPages.CustomControllerName or StandardController.

Here, the ExtensionController is known as the name of a custom controller.

public class ExtensionController {

    private final Account acct;

    public ExtensionController {

(ApexPages.StandardController stdController) {

        this.acct = (Account)stdController.getRecord();

    }

    public String getGreeting() {

        return ‘Hello ‘ + acct.name + ‘ (‘ + acct.id + ‘)’;

    }

}

Expression references the method of greeting in the extension controller.

In Salesforce, after creating an Apex class, the Controller extension, we have to implement the Controller extension by using the virtual force pages. Now, let us create the visual force which is given below.

In the given example, the user has named the Visualforce page as an extension controller. Here, the extension controller is added to the page of visual force by using the extension attribute in the component <apex:page>. Both the extension and controller attributes should be used in the component of <apex:page>.

<apex:page standardController=”Account” extensions=”ExtensionController”>

    {!greeting} <p/>

    <apex:form >

        <apex:inputField value=”{!account.name}”/> <p/>

        <apex:commandButton value=”Save” action=”{!save}”/>

    </apex:form>

</apex:page>

Every method in the controller extension is referred to with a notation {!} in the markup of visual force.

<apex:commandButton> tag saves the method along with the attribute of action.

<apex:inputField> tag the account name by using the standard controller.

                       Related Tech courses: Salesforce Integration Training

How can extensions help the user establish advanced Visualforce Pages?

As discussed in the above paragraphs, extensions have many benefits; they can have custom controllers. In the extension, we have one custom controller and may have several classes. Also, there are various scenarios in which the user can make use of the extension.

Step by step explanation of the code:

Section 1: Example of Custom Controller:

  • page standardController = “Account”
  • page block section title = “Custom Controller Example | Page Block Section 1”
  • extensions=”MyControllerExtensionExample”
  • page block title=”Page Block 1″
  • commandButton value=”Greeting”

Section 2: Standard Controller Example

  • value=”{!Account.name}”
  • commandButton value=”Standard Save”
  • pageBlockSectionItem >New Company:<apex:inputField
  • required=”False”
  • action=”{!save}”

Section 3: Custom Controller Example:

  • pageBlockSection title=”Page Block Section 3
  • action=”{!mysave}”
  • pageBlock title=”Page Block 1″
  • commandButton value=”Custom Save”

At present, Salesforce is known to be one of the best CRMs. There are more than 1,50,000+ organizations that depend on Salesforce in various areas across the world. In this field, even beginners can get good play opportunities.

This tutorial will help you to know the complete details of Salesforce.

Whether you are:

A beginner is trying to master the advanced techniques and services of Salesforce from scratch.

A developer is looking to brush up on the concepts of Salesforce.

An individual who wants to know about several job certifications and roles available to get started with Salesforce.

SALESFORCE TRAINING

Cloud Computing: Cloud computing is defined as the delivery of computational services like servers, storage, software, database, analytics, networking, and intelligence. It can bring the company faster innovation, flexibility in allocating resources, and economies of scale. Cloud computation can bring down the costs that are associated with storage and thereby contributes to the company’s development.

Migrating from the storage system, which is traditional to the cloud, will land the user in a place where the user will avail himself of many benefits like speed, cost-effectiveness, performance, productivity, security, and global scale.

  • At present, Salesforce is known to be the leading cloud-based CRM platform. It is equipped strongly with several business segments like service, sales, marketing, and so on for supporting the customer.
  • There is no need for IT professionals to set up and manage. It can also enable companies to engage with customers in different ways.

                      Related Tech courses: Cloud Computing Training

Types of Cloud Computing:

There are many types of cloud computing services available: private, public, and hybrid cloud. Let’s know the complete details about each type.

Private cloud: It is referred to as a service of cloud computing that a single company exclusively uses. A private cloud can be defined as a privately-owned network that has the infrastructure and services needed to manage cloud computing services.

Public cloud: Public cloud has been offered by third-party vendors like Microsoft Azure, Salesforce, Amazon Web Services, and so on. The vendors maintain everything like storage, servers, software, and hardware through a browser the user can manage and access the services.

Hybrid cloud: A hybrid cloud combines private and public clouds that allow sharing information or data and applications among them. It will also enable the business with many deployment options, greater flexibility and allow the user to optimize the business infrastructure, security, and compliance.

Types of Cloud Service: There are three cloud computing services: PaaS, IaaS, and Serverless. These three are built on one upon the other. Having good knowledge of these layers would be very helpful in having good knowledge of cloud technology.

Platform as a Service (PaaS): It is defined as an on-demand cloud computing environment for developing, designing, delivering, testing, and maintaining various applications. Also, it is intended to create a user-friendly platform where you can build mobile and web applications quickly without worrying about software infrastructure.

Infrastructure as a Service (IaaS): It is known as the rental type cloud computing infrastructure that includes virtual and server machines, operating systems, storage, and networks that a cloud provider facilitates.

Serverless Computing: It is a method of offering backend services that are paid based on usage. It can allow us to write and deploy the code hustle-free without relying on the underlying infrastructure. Although it is known as serverless cloud computing, physical servers still exist in the complete process.

Conclusion:

Hope, from the above article, you got the complete details about the Controller Extension in Salesforce. Still, if you have any queries regarding Salesforce, feel free to contact Gologica or call: 8296960414.

GoLogica Technologies Private Limited  © 2019. All rights reserved.