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.
We'll start by creating a Chart macro that will display Salesforce Opportunity data.
Add a Chart macro. Set the Type parameter to "bar", dataDisplay parameter to "before", and Columns parameter to "Opportunity Name" and "Amount" respectively.
Then within the Chart macro, create a Report Table macro. Set its Injected parameter to "True".
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".
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.
Back within the Report Table macro, add 5 Report Column. Set their Titles to "Account Name", "Opportunity Name", "Amount", "Probability", and "Closed Date" respectively.
In the "Account Name" Report Column macro, add a Report Info macro. Set the Key parameter to "sf:Account.Name".
In the "Opportunity Name" Report Column macro, add a Report Info macro. Set the Key parameter to "sf:Name".Â
In the "Amount" Report Column macro, add a Report Info macro. Set the Key parameter to "sf:Amount".Â
In the "Probability" Report Column macro, add a Report Info macro. Set the Key parameter to "sf:Probability".Â
In the "Closed Date" Report Column macro, add a Report Info macro. Set the Key parameter to "sf:ClosedDate".Â
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.
Add a Deck of Cards macro Set its id parameter to "OpportunitySummary".
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".
Add a Report Table macro and set its Injected parameter to "True".
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".
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.
Back within the Report Table macro, Add four Report Column macros. Set their Titles to "Name", "Amount", "Owner Name" and "Closed Date" respectively.
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%".
Back within the Report Column macro, add a Report Link macro. Set its Key parameter to "variable:OppName" and write "%sf:Name%" .Â
In the "Amount" Report Column macro, add a Report Info macro. Set the Key parameter to "sf:Amount".Â
In the "Owner Name" Report Column macro, add a Report Info macro. Set the Key parameter to "sf:Owner.Name".Â
In the "Closed Date" Report Column macro, add a Report Info macro. Set the Key parameter to "sf:Closed Date".Â
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".
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.
Back within the Report Table macro, add 4 Report Column macros. Set their Titles to "Name","Amount","Owner Name" and "Closed Date" respectively.
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".
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.
Back within the Report Table macro, add 4 Report Column macros and Set their Titles to "Name","Amount","Owner Name" and "Stage Name" respectively.
Back within the Report Column macro, add a Report Link macro. Set its Key parameter to "variable:OppName" and write "%sf:Name%" .Â
In the "Amount" Report Column macro, add a Report Info macro. Set the Key parameter to "sf:Amount".Â
In the "Owner Name" Report Column macro, add a Report Info macro. Set the Key parameter to "sf:Owner.Name".Â
In the "Stage Name" Report Column macro, add a Report Info macro. Set the Key parameter to "sf:StageName".Â
Inside the "Overall Opportunities " Card macro, do as follows:
Add three Report Variable macros and set its Name parameters to  "TotalOpportunity","WonOpportunity" and "LostOpportunity" respectively.
In the "TotalOpportunity" Report Variable  macro, add a SOQL Reporter macro. Set its Query parameter to "Select name from Opportunity".Â
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.
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".Â
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.
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".Â
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.
Back within the "Overall Opportunities " Card macro, add a 3x2 table.
In the first column of each cell, write  "WonOpportunity","LostOpportunity" and "TotalOpportunity" respectively.
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 > size" respectively.