How to do it...

Carry out the following steps to develop a custom Lightning component and add it to the account record home page within the Lightning App Builder:

  1. Click on the Setup gear icon, as shown in the following screenshot:

The Setup gear icon is located in the top right-hand area of the main Home page.

  1. Click the Developer Console option, as shown in the following screenshot:
  1. In the resulting Developer Console window, click on File.
  2. Click on New.

 

  1. Click on Lightning Component, as shown in the following screenshot:
  1. In the resulting New Lightning Bundle dialog, enter a Name and Description.
  2. Click on Submit, as shown in the following screenshot:
  1. In the resulting Component page, paste the following code:
<aura:component implements="force:hasRecordId,flexipage:availableForRecordHome,fo  rce:hasSObjectName"> 
<!-- Setup the record data for the Account --> 
<aura:attribute name="recordId" type="Id" description="This sets
the Id of the Account record"/> <aura:attribute name="account" type="Object" description="This
sets the Account object"/> <force:recordData recordId="{!v.recordId}" layoutType="FULL" targetFields="{!v.account}" mode="VIEW"/> <!-- Highlight a Prospect Account --> <aura:if isTrue="{!(v.account.Type == 'Prospect')}"> <div style="border: 1px solid rgb(255, 51, 51); color: black; font-size: 18px; background-color: rgb(255, 255, 204);"> &nbsp;{!v.account.Name} is a {!v.account.Type} account! </div> </aura:if> </aura:component>
  1. Click on File.
  2. Click on Save, as shown in the following screenshot:
  1. Now, to add the component onto the account Home page, navigate to an existing account record.
  2. Click on the Setup gear icon, as shown in the following screenshot:

The Setup gear icon is located in the top right-hand area of the main Home page.

  1. Click on Edit Page to invoke the Lightning App Builder for the account record page, as shown in the following screenshot:
  1. In the resulting Lightning App Builder page, drag and drop the AccountStatusMessage component from the custom Lightning components pane to the top of the Account Record Page canvas, as shown in the following screenshot:
  1. Click on Save.
  2. Finally, click on Back.
Custom Lightning components only appear in the list of Lightning components if you have set a custom Salesforce domain name for your organization. This is required for security reasons and is done by creating a My Domain subdomain, as detailed in the There's More... section of this recipe.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset