Salesforce Lightning: Bring Data to a Record Home Component - Part 1

August 4, 2016

Part 1: Building a Record Home Component

 

We’ve previously shown in the past how to create an integration in Apex with a third party system.  I’m going to show you how to use this information in a Lightning Component inside a record home context.

 

In order to be seen in the Lightning App Builder, your component must implement the flexipage:availableForAllPageTypes or the flexipage:availableForRecordHome interface.  availableForRecordHome makes it specifically available on record home pages, and the other makes it available for all page types.  Additionally there are two other useful interfaces for a record home component:

 

force:hasRecordId - when this interface is used it’ll populate an attribute named recordId with the active records Id

force:hasSObjectName - when this interface is used it’ll populate an attribute named sObjectName with the active records API name

 

Here is a basic component that allows you to drop it on a record home context.  It has a handler that we’ll use later to initialize the data. For now, the JS controller is very minimal.

 

Component Body

 

 

JS Controller

 

 

 

 

Design Component

 

 

 

To see the component in action on a record home page, open the Lightning App Builder and create a new page.

 

Go to Setup, and search for Lightning App Builder, then select it, then click the new button.

 

 

On the page type selection choose “Record Page”

 

 

 

 

 

Click Next. Then Choose a design layout. For this example I’m using “Header and Two Columns.”

 

 

Click Next. Then, enter a label for the record page override. After that, enter the type of SObject you want to override. For this example, I’m using Account.

 

 

 

Drop the 'Local Weather' component onto the panel on the right hand side. Then, save the layout.

 

 

Activate the record home page.

 

 

Open an account in Lightning Experience to see the component in action.

 

 

Read, Bringing Data From REST to Your Salesforce Lightning Component Part 2

 

 

If your company or nonprofit is interested in taking your Salesforce org into the Lightning era, contact us:

 

 

 

Please reload

Recent Posts
Please reload

At CRM Science, we use our Salesforce expertise to transform your enterprise. Partnering with our clients throughout the Salesforce journey, we work with leaders to strategize and optimize business processes, and design and develop solutions across every Salesforce cloud. We empower companies to innovate faster, better engage with customers, and improve bottom lines. 

CRM Science is a Salesforce Silver Consulting Partner and a Salesforce.org Registered Partner. Our strategic consulting services were recognized by Salesforce in four consecutive Salesforce Partner Innovation Awards, an annual recognition for partners that deliver outstanding client success. 

Helpful Content
Blog
Events
Client Success
Connect with us
Email Us
860 First Ave, Suite 2
King of Prussia, PA 19406
(484) 775-0333
  • Twitter
  • Facebook
  • YouTube

Copyright © 2011-2020 CRM Science, Inc. All rights reserved.