Part 4 - Creating a dashboard to display Salesforce Opportunities

In this section we will build a dashboard which displays Salesforce Opportunity information based on the Account that is filtered by the user.

Source code

The following source code is shared using Confluence Storage Format, the XHTML-based format that Confluence uses to store the content of pages, page templates, blueprints, blog posts and comments.

For more information on how to use this source code on your Confluence, read the following article:

⚙️ Expand

Steps

Part 1:

We'll start by creating a Chart macro that will display Salesforce Opportunity data.

  1. Add a Chart macro.
    Set the Type parameter to "bar", dataDisplay parameter to "before", and Columns parameter to "Opportunity Name" and "Amount" respectively.

  2. Then within the Chart macro, create a Report Table macro.
    Set its Injected parameter to "True".

  3. Within the Report Table macro, add a SOQL Reporter macro.
    Set its Query parameter to "Select Name,AccountId,Account.Name,Amount,Probability,CloseDate from Opportunity ORDER BY Account.Name, CloseDate".

  4. Within the SOQL Reporter macro, add a Text Filter macro.
    Set its Key parameter to "sf:Account.Name" and Contains Value parameter to "%data:AccountName>1%" respectively.

  5. Back within the Report Table macro, add 5 Report Column.
    Set their Titles to "Account Name", "Opportunity Name", "Amount", "Probability", and "Closed Date" respectively.

  6. In the "Account Name" Report Column macro, add a Report Info macro.
    Set the Key parameter to "sf:Account.Name".

  7. In the "Opportunity Name" Report Column macro, add a Report Info macro.
    Set the Key parameter to "sf:Name". 

  8. In the "Amount" Report Column macro, add a Report Info macro.
    Set the Key parameter to "sf:Amount". 

  9. In the "Probability" Report Column macro, add a Report Info macro.
    Set the Key parameter to "sf:Probability". 

  10. In the "Closed Date" Report Column macro, add a Report Info macro.
    Set the Key parameter to "sf:ClosedDate". 

  11. Back within Report Table macro, add a Report Empty macro.
    Write 
    "No records found".

Part 2:

In this section we'll create a dashboard to show a summarized view of Salesforce Opportunities, based on the filter that we created in Part 1.

  1. Add a Deck of Cards macro 
    Set its id parameter to "OpportunitySummary".

  2. Within the Deck of Cards macro, add three Card macros.
    Set their Labels to "Opportunities Won", "Opportunities Lost or Not Yet Won", and "Overall Opportunities".

  3. Inside the "Opportunities Won" Card macro, do as follows:
    1. Add a Report Table macro and set its Injected parameter to "True".

    2. Within the Report Table, add a SOQL Reporter macro.
      Set its Query parameter to "Select Account.name,id,name, amount, owner.name, closeDate from Opportunity Where IsWon = true".

    3. Within the SOQL Reporter macro, add a Text Filter macro and set its Key parameter to "sf:Account.Name" and Contains Value parameter to "%data:AccountName>1%" respectively.

    4. Back within the Report Table macro, Add four Report Column macros.
      Set their Titles to "Name", "Amount", "Owner Name" and "Closed Date" respectively.

    5. In the "Name" Report Column macro, add a Report Variable macro.
      Set its Name parameter to "OppName" and set its Value parameter to "<YourSalesforceURL>%sf:Id%".

    6. Back within the Report Column macro, add a Report Link macro.
      Set its Key parameter to "variable:OppName" and write "%sf:Name%

    7. In the "Amount" Report Column macro, add a Report Info macro.
      Set the Key parameter to "sf:Amount". 

    8. In the "Owner Name" Report Column macro, add a Report Info macro.
      Set the Key parameter to "sf:Owner.Name"

    9. In the "Closed Date" Report Column macro, add a Report Info macro.
      Set the Key parameter to "sf:Closed Date"

  4. Inside the "Opportunities Won" Card macro, do as follows:
    1. Add a Report Table macro.
      Set its Injected parameter to "True".

    2. Within the Report Table macro, add a SOQL Reporter macro.
      Set its Query parameter to "Select Account.name,id,name, amount, owner.name, closeDate from Opportunity Where IsWon = true".

    3. Within the SOQL Reporter macro, add a Text Filter macro
      Set its Key parameter to "sf:Account.Name" and Contains Value parameter to "%data:AccountName>1%" respectively.

    4. Back within the Report Table macro, add 4 Report Column macros.
      Set their Titles to "Name","Amount","Owner Name" and "Closed Date" respectively.

    5. In the "Name" Report Column macro, add a Report Variable macro.
      Set its Name parameter to "OppName" and the Value parameter to "<YourSalesforceURL>%sf:Id%".

    6. Back within the Report Column macro, add a Report Link macro.
      Set its Key parameter to "variable:OppName" and write "%sf:Name%

    7. In the "Amount" Report Column macro, add a Report Info macro.
      Set the Key parameter to "sf:Amount". 

    8. In the "Owner Name" Report Column macro, add a Report Info macro.
      Set the Key parameter to "sf:Owner.Name". 

    9. In the "Closed Date" Report Column macro, add a Report Info macro.
      Set the Key parameter to "sf:Closed Date". 

  5. Inside the "Opportunities Lost or Not Yet Won " Card macro, do as follows:
    1. Add a Report Table macro.
      Set its Injected parameter to "True".

    2. Within the Report Table, add a SOQL Reporter macro.
      Set its Query parameter to "Select Account.name,id,name, amount, owner.name, stageName from Opportunity Where IsWon = false".

    3. Within the SOQL Reporter macro, add a Text Filter macro.
      Set its Key parameter to "sf:Account.Name" and Contains Value parameter to "%data:AccountName>1%" respectively.

    4. Back within the Report Table macro, add 4 Report Column macros and Set their Titles to "Name","Amount","Owner Name" and "Stage Namerespectively.

    5. In the "Name" Report Column macro, add a Report Variable macro.
      Set its Name parameter to "OppName" and the Value parameter to "<YourSalesforceURL>%sf:Id%".

    6. Back within the Report Column macro, add a Report Link macro.
      Set its Key parameter to "variable:OppName" and write "%sf:Name%

    7. In the "Amount" Report Column macro, add a Report Info macro.
      Set the Key parameter to "sf:Amount". 

    8. In the "Owner Name" Report Column macro, add a Report Info macro.
      Set the Key parameter to "sf:Owner.Name". 

    9. In the "Stage Name" Report Column macro, add a Report Info macro.
      Set the Key parameter to "sf:StageName". 

  6. Inside the "Overall Opportunities " Card macro, do as follows:
    1. Add three Report Variable macros and set its Name parameters to  "TotalOpportunity","WonOpportunity" and "LostOpportunityrespectively.

    2. In the "TotalOpportunity" Report Variable  macro, add a SOQL Reporter macro.
      Set its Query parameter to "Select name from Opportunity". 

    3. Within the SOQL Reporter macro, add a Text Filter macro.
      Set its Key parameter to "sf:Account.Name" and Contains Value parameter to "%data:AccountName>1%" respectively.

    4. In the "WonOpportunity" Report Variable  macro, add a SOQL Reporter macro and set its Query parameter to "Select name,Account.name from Opportunity Where IsWon = true". 

    5. Within the SOQL Reporter macro, add a Text Filter macro.
      Set its Key parameter to "sf:Account.Name" and Contains Value parameter to "%data:AccountName>1%" respectively.

    6. In the "LostOpportunity" Report Variable  macro, add a SOQL Reporter macro.
      Set its Query parameter to "Select name,Account.name from Opportunity Where IsWon = false". 

    7. Within the SOQL Reporter macro, add a Text Filter macro.
      Set its Key parameter to "sf:Account.Name" and Contains Value parameter to "%data:AccountName>1%" respectively.

    8. Back within the "Overall Opportunities " Card macro, add a 3x2 table.

    9. In the first column of each cell, write  "WonOpportunity","LostOpportunity" and "TotalOpportunity" respectively.

    10. In the second column, add 3 Report Info macros for each row.
      Set their Key parameters to "variable:WonOpportunity > size" ,
      "variable:LostOpportunity > size" and "variable:TotalOpportunity > sizerespectively.

Macro structure

⚙️ Expand

add NEXT: Combining all the components into one