N
Common Ground News

What is client side and server side controller in Salesforce?

Author

Olivia Shea

Updated on March 06, 2026

What is client side and server side controller in Salesforce?

The framework supports client-side (JavaScript) and server-side (Apex) controllers. An event is always wired to a client-side controller action, which can in turn call an Apex controller action. For example, a client-side controller might handle an event and call an Apex controller action to persist a record.

Herein, what is client-side controller in Salesforce?

A client-side controller handles events within a component. It's a JavaScript resource that defines the functions for all of the component's actions. A client-side controller is a JavaScript object in object-literal notation containing a map of name-value pairs. Each name corresponds to a client-side action.

Also, what is client-side and server-side in lightning component? In a lightning component, the client side is a component page and the java script controller and the server side is the apex controller and the databases.

Likewise, people ask, is Apex client-side or server-side?

A JavaScript function (client-side action) with the same name as an Apex method (server-side action ) can lead to hard-to-debug issues.

What is difference between client-side and server-side validation?

Server side validation is mainly used to validate and display form level errors, while client side validation is used for field level errors. Client side validation depends on javascript and may be turned off in some browser, which can lead to invalid data saved, while server side validation is very secure.

What is server-side controller?

Call a server-side controller action from a client-side controller. In the client-side controller, you set a callback, which is called after the server-side action is completed. A server-side action can return any object containing serializable JSON data. Passing Data to an Apex Controller. Use action.

What is client-side and server-side?

Aug 20, 2020. Server-side is the systems that run on the server, and client-side is the software that runs on a user's web browser. Client-side web development involves interactivity and displaying data, server-side is about working behind the scenes to manage data.

How do you call server-side controller?

Calling a Server-Side Action
  1. <aura:component controller="SimpleServerSideController"> <aura:attribute name="firstName" type="String" default="world"/> <lightning:button label="Call server" onclick="{!c.echo}"/> </aura:component>
  2. action. setParams({ firstName : cmp.
  3. action. setCallback(this, function(response) { });

How do you call server-side action from client-side?

Server-Side Controller method can be invoked by the client-side controller by using the value provider of c. Client-side action can also be invoked by using c syntax in the component markup. In the component javascript controller cmp.

What is controller in Salesforce lightning?

For our purposes, for Lightning Components, a controller is a resource in a component bundle that holds the action handlers for that component. And action handlers are just JavaScript functions with a particular function signature.

What is setCallback in lightning?

setCallback()

Sets the callback function that is executed after an Apex action returns.

What is Apex controller in Salesforce?

A custom controller is an Apex class that implements all of the logic for a page without leveraging a standard controller. Use custom controllers when you want your Visualforce page to run entirely in system mode, which does not enforce the permissions and field-level security of the current user.

What is client side stateful in Salesforce?

Stateful Client and Stateless Server is an integral part of Lightning Component Framework which depends on JS (JavaScript) on the client side to manage UI component and application data. Client calls the server when required to optimize performance and server returns the data if required.

What is difference between with sharing and without sharing in Salesforce?

With Sharing - Enforce the sharing rules that apply to current user. Without Sharing - Doesn't enforce the sharing rules. If a class is not declared as either with or without sharing, the current sharing rules remain in effect.

What is @AuraEnabled in Salesforce?

The @AuraEnabled annotation enables client- and server-side access to an Apex controller method. Providing this annotation makes your methods available to your Lightning components (both Lightning web components and Aura components). Only methods with this annotation are exposed.

What is Aura component in Salesforce?

Aura components are the self-contained and reusable units of an app. They represent a reusable section of the UI, and can range in granularity from a single line of text to an entire app. The framework includes a set of prebuilt components. This enables you to build apps with sophisticated UIs.

What is Handler in lightning component?

The init handler is defined to execute some code when the component is initialized. That code (doInit) is defined in the component's client-side controller (you'll implement the controller in the next step). <aura:iteration> is used to iterate through the list of contacts and create an <li> for each contact.

How do you call the APEX method from lightning component?

To call an Apex method, a Lightning web component can: Wire a property. Wire a function. Call a method imperatively.

Call Apex method from Lightning Web Components

  1. apexMethod -This identifies the Apex method name.
  2. Classname – The Apex class name.
  3. Namespace –The namespace of the Salesforce organization.

What is the use of get set in Apex?

get method ( )

When visualforce page want to get the value of a variable defined in the Apex. It will invoke get method of that variable. In the above example, Visualforce page is trying to use name variable which is declared in Apex class.

What's one situation where it's better to use lightning components instead of Visualforce?

If you are developing for a Salesforce1 mobile app, you should prefer Lightning framework and if you want to create a page-centric experience with limited client-side logic, you must opt Visualforce framework.

Can we use multiple controller in lightning component?

Salesforce Lightning components bundle uses the architecture for single-page use. Single Page applications are web applications that use a single HTML file and dynamically change when the user interacts with the website. This framework supports both client-side controllers and server-side controllers.

Why do we use slots in LWC?

Slots in LWC are useful to make Lightning Web Component reusable and more flexible. It is also used to create a template in Lightning Web Component where we can create dynamic sections where the markup can be populated dynamically.

What is the value provider for the client side component controller?

The value providers for a component are v (view) and c (controller). A component's attribute set. This value provider enables you to access the value of a component's attribute in the component's markup.

What is force recordData?

A force:recordData component defines the parameters for accessing, modifying, or creating a record using Lightning Data Service. To load a record, specify its record ID, the component attributes, and a list of fields in your custom component.

What is $a in lightning?

$A is how you gain access to the underlying Aura framework, such as enqueuing actions, getting application events, managing the Aura rendering life cycle, and various utility methods.

How do you call an aura controller?

Invoke Apex from Lightning Component | how to call an Apex class from a Lightning component
  1. Add Controller attribute in <aura:Component tag to link the Apex Class like <aura:component controller="CLASSNAME">
  2. Define <aura:Attribute tag to get value and to display value in Lightning page.

What is a getCallback?

getCallback() to wrap any code that modifies a component outside the normal rerendering lifecycle, such as in a setTimeout() call. The $A. getCallback() call ensures that the framework rerenders the modified component and processes any enqueued actions.

How do you call a controller method in lightning component?

To call the server side method we need to create the instance of server side method in client side controller. We have two methods to set the parameter of server side method and get the response : 1). setParams() : To set the parameter of server side controller method.

How do you call Aura component from LWC?

How to call lwc method from Aura component
  1. parentAuraComp.cmp. <aura:component> <div>
  2. parentAuraCompController.js. ({ callChildMethod : function(component, event, helper) {
  3. childLwcComp.html. <template> <div>
  4. childLwcComp.js. import { LightningElement,api } from 'lwc';

Why we need both server and client-side validation?

The both side validation is needed for a number of reasons, some of them are: User has disabled javascript. An evil user in purpose has removed the javascript in order to exploit the system. With javascript validation you reducing the data traffic between the website and the client.

What are the main advantages of client-side and server-side validation?

The advantages to using client-side validation are two-fold users receive feedback quicker (no need to go off to the server, process the information, then download another HTML page), and also it saves load on the server - more work is done on the client side.

What is the difference between client-side and server-side validations and when do we use either or both?

If the user request requires server resources to validate the user input, you should use Server Side Validation. If the user request does not require any server resources to validate the input , you can use Client Side Validation.

Why client-side validation is faster than server-side validation?

Client-side validation is faster than server-side because, the validation takes place on client side (on browser) and the networking time from client to server is saved. On the other hand, server-side validation is done on the web server.

Is client-side validation faster?

While client-side validation is faster and favors user experience, it should not be used in isolation because client-side validation relies on the browser (which can be tricked). Client-side validation should always be used along with server-side validation as the latter is more reliable.

Does HTML5 perform client-side validation?

In the past, client-side validation could only be achieved using JavaScript or using libraries from frameworks (think jQuery validation plugin). But that is changing or rather has changed because validation can now be done using HTML5 without having to write complex JavaScript validation code.

What is front end validation?

Hi, front-end validation in forms is able to highlight wrong user input and disable the input button. This is useful to give the user some immediate feedback when entering values in the form.

What is backend validation?

Backend Validations

It's how you treat the content of that request that makes a difference. A quick recap: Never trust the data submitted by the user. Every bit of data submitted by your user has to be validated on your back end.

Is client side validation sufficient for security?

Client-side validation should only be used to improve user experience, never for security purposes. However, client side validation can be easily bypassed and should never be used for security purposes. Always use server-side validation to protect your application from malicious attacks.