Documentation

Salesforce Chart Composer: Getting Started

Salesforce Chart Composer

Disclaimer: The package “Salesforce Chart Composer” and this blog “Salesforce Guides” are both initiatives of Talha Saqib. This blog post will serve as the official documentation of the product.

What is Salesforce Chart Composer?

Salesforce Chart Composer is an unmanaged package to create various kinds of charts using Salesforce records. The product is suitable for both developers and admins as it utilizes the standard Salesforce user interface to create Chart records while also giving the option to write Custom SOQL. The charts produced through Salesforce Chart Composer can be placed on Apps, Records, and Homepages.

The complete project is available publicly on GitHub.

Getting Started

Following are the steps to get you started on the Salesforce Chart Composer package.

Installation

  • The first step is to install the unmanaged package of Salesforce Chart Composer from this link.
  • Go to Permission sets and search for “Salesforce Chart Composer” permission set and assign it to the desired set of users.

Create Sample Records

  • Before creating a chart, there must be some sample records in the org. For this example, create a set of Account records with the standard field NumberOfEmployees filled randomly.

Create a Chart record

  • Create a new “Chart” object record. Check out the complete details of this object from this page.

  • Fill the Title field with “Account Employees Count” and leave the Relationship Field blank for now.
  • Click Save.
  • Copy the auto-generated Chart Id value.

Create a Dataset for Chart

  • Open the Chart record and create a new Chart Dataset object record from the related list.
  • Fill in the Dataset fields as mentioned below.
FieldValue
Dataset LabelNumber of Employees
Chart TypeBar
Source ObjectAccount
Source FieldNumberOfEmployees
Source Label Name
Records Limit50
Sort ByNumberOfEmployees
Sort OrderAscending
Border Colorblack
Border Width1
Background Colorpink
  • Leave all other fields as default.
  • Click Save.

We can also create more related Dataset records for a single Chart record but for this example, we will only use one dataset.

Add Dynamic Filters (Optional)

Although the chart is now ready to be rendered, we can optionally add extra filters to the dataset. For that:

  • Create a new Chart Filter record from the Filters related list on the dataset record page.

  • Use the following values to create the Chart Filter. Set Field as “NumberOfEmployees“, Operator as “Greater Than“, and Value as “0“.

For best practices, name your filters as numbers e.g. 1, 2, etc.

Add Chart Component

Finally, add the chart to any of the following pages:

App Page
Home Page
Record Page

  1. Click the Gear icon on the top right.
  2. Click “Edit Page” to open Lightning App Builder
  3. From the custom components, select “chartComponent” and drag to the page.
  4. Paste the copied Chart Id in the respective input bar.
  5. Click Save.

A similar chart as shown below should be rendered.

Next Steps

The Salesforce Chart Composer has more to offer. Read the following resources to familiarize yourself with more features.

Was this helpful?

Thanks for your feedback!

Talha Saqib

About Author

As a Salesforce Certified Developer, Talha Saqib is an expert in designing and implementing custom Salesforce solutions that help businesses achieve their goals. With 3+ years of experience in the Salesforce ecosystem, Talha has a deep understanding of the platform and is expert in Sales Cloud, Service Cloud, Experience Cloud, REST APIs, Aura and more.

2 Comments

  1. Larry

    April 5, 2024

    Impressive!
    WIll it work on a visualForce page … Rendered as PDF ?

    • Talha Saqib

      April 5, 2024

      This is essentially an LWC, therefore wherever LWC is supported, this should work as well.

Leave a comment

Your email address will not be published. Required fields are marked *

You may also like

Chart
Documentation

Salesforce Chart Composer: Chart | Object Reference Guide

This record of this object represents an individual chart. It is the first record that needs to be created to
Chart Dataset
Documentation

Salesforce Chart Composer: Chart Dataset | Object Reference Guide

This record of this object represents an individual dataset of a chart. The dataset contains all the data, format, styling,