Welcome to the Salesforce Lightning Tutorial. Every company requires a Customer Relationship Management (CRM) tool to manage customer interactions. It provides a simple interface for data that helps companies recognize and communicate with customers. It helps in gaining new customers and retaining existing ones. Salesforce Lightning transforms the way that companies interact with their customers. In this post, we will give you a brief overview of Salesforce Lightning. If you are a beginner and wish to start working with Salesforce Lightning, then here's your chance. By the end of this tutorial, you will gain knowledge on what Salesforce Lightning is, what are the components involved in it, how to create components, and applications, etc. Let us get started.
Salesforce is an integrated CRM platform used by many companies for marketing, sales, service, and commerce teams. Salesforce Lightning is a component-based framework from Salesforce for developing applications. We can build responsive applications suitable for any device. We can add themes, branding elements, and personalize content with just a few clicks. It provides a dynamic application development approach where we can build single-page applications.
Start learning Salesforce course from hkrtrainings to make a bright career in the world of Salesforce!
Salesforce Lightning contains the below features.
It provides a graphical user interface through which we can create a fast and customized user experience for the sales team to sell the products easily.
Lightning App Builder
It provides drag-and-drop functionality, which enables customized app creation. We can create custom pages for the Salesforce mobile app and Lightning Experience. We can configure Lightning apps here.
Lightning Component Framework
AppExchange is like a store for Salesforce. It contains over 5000 ready-to-install solutions, and 6 million customer installs that help in solving business challenges. It also contains 50 partner components.
The Salesforce Lightning Design System (SLDS) offers a styling framework for enhancing the look and feel of your applications without having to write CSS code. We can add icons, font, color palettes to create Lightning Experience.
It helps to connect apps to access data from external sources that comply with OData specification. We can access data from systems like SAP, Oracle, etc. without copying it in Salesforce.
Here are some of the main benefits of Salesforce Lightning.
To enable Lightning development, follow these steps. First, we have to create a Namespace. It is unique across all Salesforce organizations. Login to your Salesforce Developer Edition account.
Click on 'Setup' on the top-right corner. Click on 'Create' from the left-side menu and select the 'Packages' option. Click on 'Edit' and then on 'Continue'. Give the namespace prefix and click on 'Check Availability'. If the namespace is available, click on 'Review My Selections' and click on 'Save'. Navigate to 'Setup', click on 'Develop', and then on 'Lightning Components'. Select the 'Enable Lightning Components' checkbox, and then click on 'Save'.
Check out here for frequently asked salesforce interview questions & answers
Let's setup bootstrap to make our applications more flexible. Salesforce provides a customized version of Twitter Bootstrap that we can use. Go to http://developer.salesforce.org/bootstrap-sf1/ and click on 'Download'. Once the download is complete, unzip the package. Navigate to 'Setup' in Salesforce and click on 'Build'. Click on 'Develop' and select the 'Static Resources' option. Click on 'New', and you will get some options to fill. Give the name and description. Upload the Bootstrap package (bootstrap.css) that is present in the 'dist/CSS' directory of the unzipped bootstrap folder. Click on 'Save' to complete the process. Now your Lightning environment is ready.
A lightning component is referred to as a reusable unit of an application. Open the Developer Console from your Salesforce Lightning Experience. Go to 'File' in the top-left menu. Click on 'New' and select the 'Lightning Component' option. Give the name as 'LightningComponent' and description of the lightning component. Click on 'Submit' to create the component. It will open two tabs by default - the 'LightningComponent' tab and the 'LightningComponent.cmp' tab. Replace the content of the 'LightningComponent.cmp' tab
Save the file by ctrl + s and close the tab. We can't see the output of a component unless we use it in a lightning application.
Creating a Lightning Application
In the Developer Console, go to 'File' in the top-left menu. Click on 'New' and select the 'Lightning Application' option. Give the name as 'SampleApplication', enter the description, and click on 'Submit'. This creates a lighting application bundle. It will open two tabs by default - the 'SampleApplication' tab and the 'SampleApplication.app' tab. Replace the content of the 'SampleApplication.app' tab
LightningComponent is the name of the lightning component that we created in the above section. This connects your application with the specified lightning component. Save your application by ctrl + s. Click on 'Preview' from the application bundle on the right-side. A page opens up with the text below.
This is my first Lightning Application
This is a sample Lightning Component
Congratulations, you have successfully created a lightning application and connected a lightning component to it.
[Related Article: Salesforce Tutorial]
Attributes and Expressions in Lightning Components
While we create a Lightning Component, we can use attributes and expressions to make the component dynamic. It holds values, and we can reuse them in the code. We can add attributes with the help of tags. An attribute name should start with an alphabet or underscore. It can only contain alphanumeric or underscore characters. Attributes in Lightning are very similar to markup language. Here are the attribute types that lightning supports.
An expression is for calculation with property values and other information. Expressions are useful for giving dynamic outputs or getting values to the component dynamically. An expression can be a combination of variables, literal values, sub-expressions, and operators. We can only declare an expression inside an attribute within the tags. Expressions are case sensitive.
Salesforce Lightning is an intelligent customer relationship platform that helps organizations to sell faster and smarter. It provides the latest innovation in improving the users' experience. Salesforce Lightning is introduced to help the 150,000 customer base more successful. It lets you engage deeply with your customers and build unique relationships with them.
other related articles: