Category: component

Salesforce Lightning Component – Application Event

In continuation to my previous post about component event in Salesforce Lightning, today I would like to discuss about the another type of event i.e. Application event.Application event in Salesforce Lightning follows publish-subscribe model. An application is fired from an instance of a component. All components that provide a handler for the event will be notified once the event is fired. Below diagram will give you a more clear picture -As the above diagram tells – Component 1 is firing the event and that information is getting passed to Salesforce framework. Now all the events – Component 2, 3, 4 & 5 are already registered as handler of this event. So it is now Salesforce framework who will notify all these components that the event has occurred. Here you can see that all the components are very much loosely coupled because when Component 1 is firing the event, it does not know or rather it does not care which component is going to handle that event. Similarly when Component 2 or 3 or 4 or 5 will get notified that the event has occurred, they really don’t know which component has fired the event. This approach makes that component very much loosely coupled.Now I will start with few basic and later I will give you an example to understand Application event.CREATE CUSTOM APPLICATION EVENT:To create Application event, you need...

Read More

Salesforce Lightning Component Framework – All you need to know to get started…

Salesforce Lightning Component framework is really awesome. This is the framework which is having Apex on the server-side and JavaScript on the client-side. In this post, I will go through few objects, functions, concepts which will be used very frequently in most of the framework. So let’s get started -Controller -Below is one controller function. It takes three parameters component, event, helper.  Controller functions are used for client-side activities. For example – behavior on button click, form submit etc. can be defined inside a controller function. When calling this functions, as a developer, you don’t need to set these parameters, the framework will populate them with the required values.Helper Functions – This is the place where you will write all your codes which will be shared between components or sub components. If you have something non-trivial logic, you should move that to helper function and let your controller call the helper function. Below is one example where I am retrieving all cases. Now to retrieve cases, I need to write SOQL and that is something happening inside Apex controller (Server-Side). So my helper function getCases is calling the Apex controller’s function and I am calling my handling function (getCases) from controller function. The advantage with this approach is that now I can call getCases whenever required from my controller. I don’t need to repeat the same login every time.Component – Lightning component is...

Read More

Lightning strikes Trailhead – Fun way to learn Lightning

Trailhead is one of my favourite approach to learn new stuffs from Salesforce in an interactive way. I highly recommend employers to encourage all it’s developers and administrators to check trailhead and learn new stuffs.Trailhead brings a new module “Lightning Components” which will help developers to understand lightning concepts. In today’s post, I will review this new module “Lightning Components”.This module comes with 9 different sub modules. All the sub modules are organised so well that at the end of 9th sub module, you will feel really comfortable and at the same time feel the power of lightning which will definitely inspire you to explore the unexplored world.Let’s start discussing each sub module.Sub Module 1: Getting Started with Lightning Components -This is the first sub module which will give you an overview of Lightning Components. By the end of this module you will understand below important concepts -What is all about Lightning Component Framework?Difference between Lightning and VisualforceWhat are the different places where you can use the Lightning Component framework?This sub module mainly tells you how you can go for component based development. Google is having Polymer, Facebook is having React and now Salesforce is also having Lightning Framework – Component based development.After completing the challenge, you can earn 100 points.Sub Module 2: Creating Components -This is the module where you will get familiar with creating lightning components, adding...

Read More
Loading