Part 4 - Creating a dashboard to display Salesforce Opportunities
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:
We'll start by creating a Chart macro that will display Salesforce Opportunity data.
Add a Chart macro. Set theType parameter to "bar", dataDisplay parameter to "before", and Columns parameter to "Opportunity Name" and "Amount" respectively.
Then within the Chart macro, create aReport Tablemacro. 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" andContains Valueparameter to "%data:AccountName>1%" respectively.
Back within the Report Table macro, add 5Report Column. Set theirTitlesto "Account Name","Opportunity Name", "Amount", "Probability", and "Closed Date" respectively.
In the "Account Name"Report Columnmacro, add a Report Info macro. Set the Key parameter to "sf:Account.Name".
In the "Opportunity Name"Report Columnmacro, add a Report Info macro. Set the Key parameter to "sf:Name".
In the "Amount"Report Columnmacro, add a Report Info macro. Set the Key parameter to "sf:Amount".
In the "Probability"Report Columnmacro, add a Report Info macro. Set the Key parameter to "sf:Probability".
In the "Closed Date"Report Columnmacro, 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 threeCardmacros. Set their Labels to "Opportunities Won", "Opportunities Lost or Not Yet Won", and"Overall Opportunities".
Inside the "Opportunities Won"Cardmacro,do as follows:
Add a Report Tablemacro 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" andContains Valueparameter to "%data:AccountName>1%" respectively.
Back within the Report Table macro, Add four Report Column macros. Set theirTitlesto "Name", "Amount", "Owner Name"and "Closed Date" respectively.
In the "Name"Report Columnmacro, add aReport 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 itsKey parameter to "variable:OppName" and write "%sf:Name%" .
In the "Amount"Report Columnmacro, add a Report Info macro. Set the Key parameter to "sf:Amount".
In the "Owner Name"Report Columnmacro, add a Report Info macro. Set the Key parameter to "sf:Owner.Name".
In the "Closed Date"Report Columnmacro, add a Report Info macro. Set the Key parameter to "sf:Closed Date".
Inside the "Opportunities Won"Cardmacro,do as follows:
Add a Report Tablemacro. Set its Injected parameter to "True".
Within the Report Table macro, add a SOQL Reporter macro. Set its Query parameter to "SelectAccount.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" andContains Valueparameter to "%data:AccountName>1%" respectively.
Back within the Report Table macro, add 4 Report Column macros. Set theirTitlesto "Name","Amount","Owner Name"and "Closed Date" respectively.
In the "Name"Report Columnmacro, add aReport Variable macro. Set its Name parameter to "OppName" and the Value parameter to "<YourSalesforceURL>%sf:Id%".
Back within the Report Column macro, add a Report Link macro. Set itsKey parameter to "variable:OppName" and write "%sf:Name%" .
In the "Amount" Report Columnmacro, add a Report Info macro. Set the Key parameter to "sf:Amount".
In the "Owner Name"Report Columnmacro, add a Report Info macro. Set the Key parameter to "sf:Owner.Name".
In the "Closed Date"Report Columnmacro, add a Report Info macro. Set the Key parameter to "sf:Closed Date".
Inside the "Opportunities Lost or Not Yet Won "Cardmacro,do as follows:
Add a Report Tablemacro. 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, stageName from Opportunity Where IsWon = false".
Within the SOQL Reporter macro, add a Text Filter macro. Set its Key parameter to "sf:Account.Name" andContains Valueparameter to "%data:AccountName>1%" respectively.
Back within the Report Table macro, add 4 Report Column macros and Set theirTitlesto "Name","Amount","Owner Name"and "Stage Name" respectively.
In the "Name"Report Columnmacro, add aReport Variable macro. Set its Name parameter to "OppName" and the Value parameter to "<YourSalesforceURL>%sf:Id%".
Back within the Report Column macro, add a Report Link macro. Set itsKey parameter to "variable:OppName" and write "%sf:Name%" .
In the "Amount"Report Columnmacro, add a Report Info macro. Set the Key parameter to "sf:Amount".
In the "Owner Name"Report Columnmacro, add a Report Info macro. Set the Key parameter to "sf:Owner.Name".
In the "Stage Name"Report Columnmacro, add a Report Info macro. Set the Key parameter to "sf:StageName".
Inside the "Overall Opportunities"Cardmacro,do as follows:
Add threeReport Variable macros and set its Name parameters to "TotalOpportunity","WonOpportunity"and "LostOpportunity" respectively.
In the "TotalOpportunity"Report Variablemacro, 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" andContains Valueparameter to "%data:AccountName>1%" respectively.
In the "WonOpportunity"Report Variablemacro, add a SOQL Reporter macro and set its Query parameter to "Select name,Account.namefrom Opportunity Where IsWon = true".
Within the SOQL Reporter macro, add a Text Filter macro. Set its Key parameter to "sf:Account.Name" andContains Valueparameter to "%data:AccountName>1%" respectively.
In the "LostOpportunity"Report Variablemacro, add a SOQL Reporter macro. Set its Query parameter to "Select name,Account.namefrom Opportunity Where IsWon = false".
Within the SOQL Reporter macro, add a Text Filter macro. Set its Key parameter to "sf:Account.Name" andContains Valueparameter to "%data:AccountName>1%" respectively.
Back within the "Overall Opportunities"Cardmacro, 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.
Macro structure
Click here for the macro structure...
JavaScript errors detected
Please note, these errors can depend on your browser setup.
If this problem persists, please contact our support.