Learning Salesforce Lightning Application Development

Book description

Build, design, and style beautiful and informative applications on the Salesforce Lightning platform

Key Features

  • Build and Test Lightning Components that enhance application usability and adaptability
  • Apply Security Best Practices to your Custom Lightning Components
  • Design Lightning Components for Salesforce UIs such as Lightning Pages, Salesforce 1 Application, Communities, and more.

Book Description

Built on the Salesforce App Cloud, the new Salesforce Lightning Experience combines three major components: Lightning Design System, Lightning App Builder, and Lightning Components, to provide an enhanced user experience. This book will enable you to quickly create modern, enterprise apps with Lightning Component Framework.

You will start by building simple Lightning Components and understanding the Lightning Components architecture. The chapters cover the basics of Lightning Component Framework semantics and syntax, the security features provided by Locker Service, and use of third-party libraries inside Lightning Components. The later chapters focus on debugging, performance tuning, testing using Lightning Testing Services, and how to publish Lightning Components on Salesforce AppExchange.

What you will learn

  • Understand Lightning Components architecture
  • Learn Locker security best practices
  • Debug and Improve performance of your Lightning Components
  • Use third-party libraries along with Lightning Component Framework
  • Learn how to publish Lightning Components on AppExchange
  • Use Lightning Out to take your Lightning Components outside the Salesforce platform

Who this book is for

This book is for Salesforce developers or developers from other platforms who are familiar with HTML, CSS, and JavaScript and want to build and test Salesforce Lightning components. No knowledge of Salesforce Lightning is required.

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. Learning Salesforce Lightning Application Development
  3. PacktPub.com
    1. Why subscribe?
    2. PacktPub.com
  4. Foreword
  5. Contributors
    1. About the author
    2. About the reviewers
    3. Packt is searching for authors like you
  6. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  7. Introduction to the Lightning Component Framework
    1. Lightning Experience
      1. Lightning Application
        1. Creating a Lightning Application
      2. Creating tabs in Lightning Experience
        1. Lightning Component Tabs
        2. Lightning Page Tabs
      3. Lightning App Builder
      4. Lightning Utility Bar
      5. List views in the Lightning UI
      6. The ability to calendar data in the Date and Datetime fields
      7. Global Actions
      8. Publisher actions
    2. Lightning Component architecture
      1. The concept of web components
      2. Lightning Component Bundle
        1. Lightning Component lifecycle
        2. MVC concepts in the Lightning Component framework
    3. Setting up a Salesforce developer organization to enable the building of Lightning Components
      1. Creating a simple hello world Lightning Component
    4. The Lightning Design system
      1. Creating a simple card component using SLDS 
    5. Summary
  8. Exploring Salesforce DX
    1. Enabling the developer hub in your Salesforce organization
      1. Enabling the developer hub
    2. Installing the Salesforce DX CLI
    3. Salesforce DX commands
      1. auth commands
      2. Setting a default Dev Hub for scratch Org creation
      3. Creating a new Salesforce DX project
        1. Configuring a scratch Org definition JSON
        2. Configuring project definition JSON
      4. Creating a scratch Org
        1. Opening the scratch Org
        2. Pulling source from a scratch Org
        3. Push source code to a scratch Org
        4. Conflict resolution
        5. Ignoring files
    4. Lightning commands
      1. Creating a Lightning app and components
    5. Metadata API commands
      1. mdapi:convert and mdapi:retrieve
        1. Converting existing managed/unmanaged package code to DX Format
      2. Deploy command
    6. Data import and export commands in Salesforce DX
      1. Data export Salesforce DX command
      2. Data import Salesforce DX command
      3. Bulk data upsert Salesforce DX command
        1. Limitations of bulk upsert commands
    7. Installing the Visual Studio extension pack for DX
      1. Developer workflow for building a Salesforce application 
    8. Summary
  9. Lightning Component Building Blocks
    1. Component markup and using Lightning base components for layouts
      1. Component definition aura:component
        1. Access modifier
        2. Providing a description to component
        3. Implementing interfaces in Lightning Components
      2. Lightning base components for layout and layout items
      3. Lightning card base component
      4. Example layouts using the Lightning layout and card components
        1. Horizontal alignment using the Lightning layout base component
        2. Vertical alignment using the Lightning layout base component 
        3. Stretching a LayoutItem using the flexibility attribute
        4. Creating multiple rows and controlling the size of the row in Lightning layout
        5. Lightning layout to handle multiple devices
        6. Nested page layout using Lightning Layouts
    2. Understanding attributes
    3. Using Expression syntax
    4. JavaScript controller and helper
    5. Wiring the client-side to the server using Apex controllers
    6. Summary
  10. The Lightning JavaScript API
    1. Technical requirements
    2. Using component get and set methods
    3. Using the find function to locate the DOM
    4. Introducing Locker Service
      1. Strict mode enforcement in Locker Service
      2. Understanding the DOM access containment hierarchy in Lightning Components 
        1. The proxy object in Locker Service
    5. APIs available in $A top-level functions
      1. Exploring the $A.Util APIs
    6. Format date/DateTime using the Aura Localization Service
      1. Find your organization's time zone
      2. Find your organization's local currency
      3. Formatting dates 
    7. Dynamically creating components using $A.createComponent()
      1. Destroying components using the destory() function
    8. Modifying the DOM in the RENDERER JavaScript file of the component bundle
      1. Understanding the rendering life cycle of a component
      2. Understanding re-rendering the life cycle of a component
    9. Using custom labels in Lightning Components
      1. Dynamically populating label parameters
    10. ES6 support in Lightning Components
      1. An introduction to Promises
        1. Promise support in Lightning Components
    11. Summary
  11. Events in the Lightning Component Framework
    1. Browser events
      1. Capturing browser events
      2. Event handling in Lightning base components
    2. Application events
      1. Creating application events
      2. Registering application events
        1. Firing an application event
      3. Handling application events
        1. Getting event attributes from a handled event
      4. Handling capturing and bubbling events
    3. Component events
      1. Creating a component event
      2. Registering a component event
        1. Firing the component event
      3. Handling component events
        1. Alternate syntax to handle events raised by child components
        2. Getting event attributes from handled events
    4. Creating a sales LeaderBoard Lightning Application using events
    5. Communicating between components
      1. Passing data down the component hierarchy
      2. Using aura:method to call child methods from parent methods
        1. Using the aura method asynchronously
      3. Optimal event architecture design pattern
      4. Adding custom events to components dynamically
    6. Summary
  12. Lightning Data Service and Base Components
    1. Lightning Data Service
      1. Loading Salesforce record context data using force:recordData 
      2. Functions available for CRUD records
        1. Saving existing records
        2. Creating a new record
        3. Deleting records
        4. Using SaveRecordResult 
    2. Example components using Lightning Data Service
    3. Lightning base components
      1. An introduction to Lightning input field components
        1. Creating an input form using the RecordEdit and Lightning input field components
          1. Introducing events and attributes in Lightning record edit form and input field
      2. Creating a contact edit form using the Lightning input field and RecordEditForm components
      3. Using the Lightning output field component
      4. The list view component 
      5. Creating a tree view using the tree and tree grid components
      6. Formatting output data using Lightning base components
      7. Using the datatable component
      8. Using Lightning input components
      9. Using the carousel component
    4. Summary
  13. Using External JavaScript Libraries in Lightning Components
    1. Third-party JavaScript libraries in Lightning Components
      1. Attributes
      2. Events
      3. Integrating a third-party library into Lightning Components
      4. Integrating the Select2 JavaScript library into Lightning Components
      5. Integrating the MomentJs library into Lightning Components
      6. Creating a Locker Service-compliant JavaScript bundle using webpack
        1. Introduction to webpack
          1. Entry
          2. Output
          3. Loaders
          4. Plugins
        2. Integrating choices.js into Lightning Components
          1. Structuring a JS-heavy project in Salesforce DX
          2. Creating a Locker Service-compatible bundle with webpack
      7. ChartJs in Lightning Components
      8. Making client-side calls to external sites using JavaScript
      9. Communication between the Lightning main frame and iframe
        1. Communication from the Visualforce page to the Lightning Component
        2. Communication from the Lightning Component to the Visualforce page
      10. Rendering a React application in a Lightning Component using Lightning:container
        1. Rendering  reactApp using the LCC npm module in a Lightning Component
        2. Limitations of Lightning:container
    2. Summary
  14. Debugging Lightning Components
    1. Enabling Debug Mode
    2. Salesforce Lightning Inspector 
      1. Lightning Salesforce Inspector tabs
        1. Component Tree
          1. $auraTemp
        2. Transactions tab
        3. Performance tab
        4. Event Log tab
        5. Actions tab
        6. Storage tab
    3. Salesforce community page optimizer
    4. Using the Chrome developer Console
      1. Setting breakpoints in the Chrome developer Console
      2. Pause on caught exceptions
    5. Apex debugging
      1. Using the Salesforce CLI to stream logs
      2. Advanced debugging with the Replay Debugger
    6. Summary
  15. Performance Tuning Your Lightning Component
    1. Storable actions
      1. When to use storable actions?
    2. Avoiding nested aura:if in aura:iteration
      1. $A.createComponent() for lazy loading
      2. Using plain old JavaScript to gain maximum performance
    3. Events strategy for performance and ease of code maintenance
      1. Event anti-patters that can cause a performance bottleneck
        1. <aura:iteration> – multiple items set
    4. Optimizing JavaScript in Lightning Components
    5. Unbound expression bindings
    6. Using the Lightning data service
    7. Leveraging Lightning base components
      1. Creating a record form, using Lightning:recordForm
    8. Optimizing Apex code
      1. Limiting data rows for lists
      2. Reducing server response time, using the platform cache
      3. Avoiding sending responses from Apex as wrapper objects
    9. Disabling Debug Mode for production
    10. Summary
  16. Taking Lightning Components out of Salesforce Using Lightning Out
    1. Lightning Out in Visualforce
      1. Creating a Lightning dependency application
      2. Adding Lightning Components for the Visualforce JavaScript library
      3. Adding JavaScript to create a component on a Visualforce page
    2. Lightning Out in a Node.js application
      1. Creating a connected application 
      2. Setting up a Node.js application
        1. Creating a Lightning Out application 
        2. Deploying Node.js application on Heroku
    3. Lightning Out for unauthenticated users
    4. Lightning Out limitations and considerations
    5. Summary
  17. Lightning Flows
    1. Introducing Flows
      1. Creating the Lead Finder app using the Flow builder
      2. Running Flows in Lightning Experience
      3. Debugging Flows
    2. Adding custom components in Flow builder
      1. Using asynchronous XHR calls in customized Lightning Components
      2. Using Lightning Components as local Flow actions
      3. Embedding Flows into a Lightning Component
    3. Summary
  18. Making Components Available for Salesforce Mobile and Communities
    1. Using Lightning Components in a Salesforce mobile application
      1. Setting up the Chrome browser to simulate the Salesforce mobile app experience
      2. Adding a Lightning Component to the Salesforce mobile navigation
      3. Adding Lightning Components as global and object-specific actions
    2. Lightning Components in Community Cloud
      1. Creating communities in Salesforce
      2. Creating a theme layout
      3. Creating custom content layouts
      4. Overriding search, profile menu, and navigation in communities using customized Lightning Components
        1. Overriding a standard search interface
        2. Overriding a profile menu
        3. Adding custom navigation
    3. Summary
  19. Lightning Navigation and Lightning Console APIs
    1. Adding navigation support using Lightning :navigation
    2. Introducing the Lightning Console
      1. Utility Bar component
        1. Page context in the Utility Bar API
      2. Workspace API
      3. Standard Lightning tab events in the console
    3. Summary
  20. Unit Testing Lightning Components
    1. Introduction to Jasmine
      1. Jasmine syntax and terminology
        1. Suite
        2. Spec
        3. Setup and teardown
        4. Spies
      2. Quickstart example
    2. LTS
      1. Writing tests for a YouTubeSearchApp
        1. Installing LTS
        2. Creating a Lightning Component test via CLI
          1. Testing for search terms rendered via two-way binding
          2. Verifying the response by mocking the server response using Jasmine spy
        3. Testing application events
    3. Summary
  21. Publishing Lightning Components on AppExchange
    1. Namespacing Salesforce developer instances for managed package generation
    2. The impact of namespacing Salesforce instances on the component bundle
    3. Creating scratch Orgs with namespaces
    4. Creating a managed package
    5. Documenting your components using the auradoc file
    6. Using the design file to allow admins to configure attributes
    7. Publishing components on AppExchange
    8. Summary
  22. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Learning Salesforce Lightning Application Development
  • Author(s): Mohith Shrivastava
  • Release date: July 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781787124677