Book Image

Salesforce CRM Admin Cookbook - Second Edition

By : Paul Goodey
Book Image

Salesforce CRM Admin Cookbook - Second Edition

By: Paul Goodey

Overview of this book

Salesforce CRM is a market-leading customer relationship management (CRM) application that is accessed over the internet. This application greatly enhances a company's sales performance, improves customer satisfaction, and provides a robust customer relationship management system for an organization. Salesforce CRM Admin Cookbook, Second Edition enables you to instantly extend and unleash the power of Salesforce CRM and its Lightning Experience framework. It provides clear, comprehensive instructions along with detailed screenshots and code. Whether you are looking for solutions to enhance the core features, such as data management, process automation, data validation, and home page administration, or are looking for ideas on advanced customization techniques, this book will provide you with immediate, practical, and exciting real-world recipes. This book guides you through interesting topics spanning a variety of functional areas. Recipes are provided that allow you to configure, build and extend the capability of Salesforce CRM using the Lightning Experience framework.
Table of Contents (16 chapters)
Title Page
Credits
About the Author
Acknowledgements
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Developing a Lightning component to display a custom logo on a customized Home page


Within the Salesforce CRM application, you can natively add rich-text-related sections to the Home page that can be configured to present messages and hyperlinks, and launch email applications.

Using Lightning App Builder, the Home page can be configured with the use of the standard Rich Text Lightning component, which supports formatted text, URLs, and email links as covered in other recipes within this chapter.

Organizations often have a requirement to brand the software applications that are in use by their employees or display graphic notifications, such as terms and conditions of system use, and this can be achieved in Salesforce CRM by displaying a custom image on the landing Home page.

Salesforce does not, however, provide a way of adding custom images to the Home page natively using a standard component within Lightning App Builder; therefore, we are going to develop a custom Lightning component to fulfill this requirement.

Getting ready

In this recipe, we are going to display a company logo on the Home page and we can either use an image file that we have created ourselves or use one obtained from an external source.

We will store the image file in the Salesforce CRM application as a resource so we can maintain a copy, and this will then be linked to enable the image to be referenced in our Lightning component.

Carry out the following steps to upload an image file into Salesforce CRM using Static Resources:

  1. Create or source a suitable image to be used as a company logo in the JPG, GIF, or PNG format and approximately 200 x 40 pixels, as shown in the following screenshot:
  1. Click on the Setup gear icon, as shown in the following screenshot:

Note

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

  1. Click the Setup option, as shown in the following screenshot:
  1. Type static resources in the Quick Find search box, as shown in the following screenshot:

  1. Select the Static Resources option.
  2. Click on New, as shown in the following screenshot:
  1. Click on New.
  2. Enter the name of the Static Resource in the Name field. For this recipe, type WidgetsXYZlogo.
  3. Enter This is the company logo for WidgetsXYZ in the Description field.
  4. In the file uploader control, click on the Browse... button to select the image to upload from your computer. In this recipe, choose the image identified in step 1.
  5. Ignore the Cache Control picklist selection and leave it as default Private (Cache Control is only relevant to static resources used in https://www.force.com/, a Salesforce technology used for creating public web applications and web sites).
  6. The Static Resources setup screen appears as shown in the following screenshot:

  1. Click on Save.
  2. In the resulting Static Resource Detail page, click on View file, as shown in the following screenshot:
  1. In the resulting Static Resource Detail page, you can verify that the image is loaded by clicking on View file, which will load the file that has been uploaded. In our example, this is our company logo:

How to do it...

Carry out the following steps to develop a custom Lightning component and add it to an existing Home page within Lightning App Builder:

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

Note

The Setup gear icon is located in the top right-hand corner 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.
  3. Click on Lightning Component, as shown in the following screenshot:
  1. In the resulting New Lightning Bundle dialog, enter CompanyLogo for the Name.
  2. Enter This is a Company Logo Component for the Description.

 

  1. Click on Submit, as shown in the following screenshot:
  1. In the resulting Component page, paste the following code:
<aura:component implements="flexipage:availableForAllPageTypes" access="global"> 
   <img src="{!$Resource.WidgetsXYZlogo}"/> 
</aura:component> 
  1. Click on File.
  2. Click on Save, as shown in the following screenshot:
  1. Now, to add the component to an existing Home page using Lightning App Builder, click on the Setup gear icon, as shown in the following screenshot:

Note

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

  1. Click the Setup option, as shown in the following screenshot:

  1. Type app builder in the Quick Find search box, as shown in the following screenshot:
  1. Select the Lightning App Builder option.
  2. Click the Edit link for the Home_Page_Default customized Home page, as shown in the following screenshot:

  1. In the resulting Lightning App Builder page, drag and drop the CompanyLogo component from the custom Lightning Components pane to the top of the Home page canvas, as shown in the following screenshot:

Note

At the time of writing, 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.

How it works...

The customized Home page for the assigned users will appear with the custom logo, as shown in the following screenshot:

 

There's more...

Custom Lightning Components are only available for use 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. Carry out the following to set up a My Domain subdomain:

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

Note

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

  1. Click the Setup option, as shown in the following screenshot:
  1. Type my domain in the Quick Find search box.
  2. Click on My Domain, as shown in the following screenshot:

  1. Enter name.
  2. Click on Check Availability.
  3. Click on Register Domain, as shown in the following screenshot:

  1. Click on Deploy to Users.
  2. Click on OK to confirm, as shown in the following screenshot:

  1. In the resulting screen, the final step, My Domain Settings are displayed, as shown in the following screenshot: