This lesson will cover the following topics:

01 Getting Started

This video covers the data source options for your charts and graphs.

02 Object Source

1. Insert a chart into your project. The Salesforce Configuration window opens.

Charts tab in the element menu

2. Select Object as the source, use the dropdown to choose your Salesforce object, and configure the number of records to pull. You can return up to 2000 returns. Click Next.

Salesforce Configuration showing the select source step

3. Configure any conditions or filters you require and click Next.

Salesforce configuration showing the conditions step

4. Configure the mapping for your X and Y axis. You can choose to format how the data displays for each axis. Click Apply.

Salesforce Configuration window showing the mapping tab

The configured chart will display each opportunity stage and the number of opportunities in each stage.

pie chart example

03 Report Source

1. Insert a chart into your project. The Salesforce Configuration window opens.
chart tab in element menu

2. Select Report as the source, use the dropdown to select the report in Salesforce, and set the number of records to pull. When using a report as your source, it must be in your recently viewed list. This can be done by logging into your Salesforce account and opening the report you want to use. Click Next.
Salesforce Configuration window showing the select source step

3. You do not need to set conditions when using a Report as your source as these filters are set on your report in Salesforce. If you require additional filters, add them in the Conditions step. Click Next.
Salesforce configuration window showing the conditions step

4. Configure the mapping for your X and Y axis. You can choose to format how the data displays for each axis. Click Apply.
Salesforce configuration window showing mapping step

The configured chart will display each opportunity stage and the opportunity name. Remember to use a simple report when using it as a source for a chart.
bar chart example

04 Custom Source

The custom source will display summary data without creating a Salesforce report.

1. Insert a chart into your project. The Salesforce Configuration window opens.
Charts tab in the element menu

2. Select Custom as the source, and use the dropdown to select the object in Salesforce. Click Next.
Salesforce configuration window showing the select source step

3. Configure any conditions or filters you require and click Next.
Salesforce configuration window showing conditions step

4. Configure your mapping options. You can choose between count and sum aggregate types. Use the dropdowns to configure the Period, Amount, and Group By options, Click Apply.
Salesforce configuration window showing the mapping step

The chart configured will display the opportunity amount by the close month.
Example chart

05 Apex Class Source

The Apex Class source is useful if you have a complex query that Titan or Salesforce Reports does not support. Click here to add an Apex Class in Salesforce

1. Insert a chart into your project. The Salesforce Configuration window opens.

Chart tab in the element menu

2. Select your Apex as the source, enter the name of your ApexClass, and choose the number of records to pull. Click Next.

Salesforce configuration window showing select source step

A simple ApexClass is used for this example.

@RestResource(urlMapping='/TITANordAddinDemoRest')
global without sharing class TITANNordAddinDemoRest {
    @httpPost
     global static List<Opportunity> handlePost(){
         String reqdata = RestContext.request.requestBody.toString();

         FRequest ftreq = (FRequest) JSON.deserialize(reqdata, FTRequest.class);
         System.debug('ftreq >>>>> ' ftreq);
         if(String.isEmpty(ftreq-account_id)) return null;
         String account_id = ftreq.account_id;
         System.debug('account_id >>>>>> ' + account_id.split('<br>'));
         Map<String, Schema.SObjectField> fieldMap = Opportunity.sObjectType.getDescribe().fields.getMap();
         Set<String> fieldNames = fieldMap.keySet();
         List<String> fldn_lst = new List<String>();
         fldn_lst.addAll(fieldNames);
         List‹Opportunity> opps = Database.query('SELECT + String.join(fldn_lst, ',') + ' FROM Opportunity WHERE AccountId=:account_id');
        System.debug(*opps >>>>+ opps);
        return opps;
   }
   class FRequest{
        String account_id;
    }
}

To retrieve the relevant details, navigate to workbench.developerforce.com. For this example, the opportunities for an account will be pulled.


3. Configure the Parameter to filter your results, for example, if you only want specific opportunities associated with an account. Click Next.
Salesforce window showing parameters step

4. Configure the mapping according to the fields on the Salesforce object, as implemented in a simple Apex class example.
Salesforce configuration window showing the mapping step

The chart was configured to display the Account opportunities in each stage and the corresponding amount.
bar chart example

06 Got Feedback?

Additional Resources