Part 3 - Building a dashboard to display Salesforce Cases

In this section we will build a dashboard which displays Salesforce Case 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

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

  2. Within the Deck of Cards macro, add three Card macros.
    Set their labels to "Created this week", "Created this month", and "Unclosed Cases".

  3. Inside the "Created this week" Card macro, do as follows:
    1. Add a Report Variable macro and set its Name parameter to "TotalCreatedThisWeek".

    2. Within the Report Variable macro, add a SOQL Reporter macro.
      Set its Query parameter to "Select Id,ContactId,OwnerId,CaseNumber,Contact.Name,Subject,Status,Priority,CreatedDate,Owner.Name,ClosedDate,LastModifiedDate from Case where CreatedDate = THIS_WEEK".

    3. Back within the Card macro, write "Total created this week:".
      Add a Report Info macro and sets its Key parameter to "sf:variable:TotalCreatedThisWeek > size".

    4. Add a Report Table macro.
      Set its Injected parameter to "True".

    5. Within the Report Table macro, add a SOQL Reporter macro.
      Set its Query parameter to "Select Id,ContactId,OwnerId,CaseNumber,Contact.Name,Subject,Status,Priority,CreatedDate,Owner.Name,ClosedDate,LastModifiedDate from Case where CreatedDate = THIS_WEEK".

    6. 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.

    7. Back within the Report Table macro, add 11 Report Column macros and Set their Titles to "Case #", "Reporter","Subject","Description", "Status", "Priority","Assignee","Created" ,"updated" and "Closed" respectively.

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

    9. Back within the Report Column macro, add a Report Link macro and set its Key parameter to "variable:curpath" and enter "%sf:CaseNumber%

    10. In the "Reporter" Report Column macro, add a Report Info macro.
      Set the Key parameter to "sf:Contact.Name". 

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

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

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

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

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

    16. In the "Created" Report Column macro, add a Report Info macro.
      Set the Key parameter to "sf:CreatedDate". 

    17. In the "updated" Report Column macro, add a Report Info macro.
      Set the Key parameter to "sf:LastModifiedDate". 

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

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

  4. Inside the "Created this Month" Card macro, do as follows:

    1. Add a Report Variable macro.
      Set its Name parameter to "TotalCreatedThisMonth".

    2. Within the Report Variable macro, add a SOQL Reporter macro.
      Set its Query parameter to "Select Id,ContactId,OwnerId,CaseNumber,Contact.Name,Subject,Status,Priority,CreatedDate,Owner.Name,ClosedDate,LastModifiedDate from Case where CreatedDate = THIS_MONTH".

    3. Back within the Card macro, write "Total created this week:".
      Add a Report Info macro within the Card macro.
      Set 
      its Key parameter to "sf:variable:TotalCreatedThisWeek > size".

    4. Add a Report Table macro
      Set its Injected parameter to "True".

    5. Within the Report Table macro, add a SOQL Reporter macro.
      Set its Query parameter to "Select Id,ContactId,OwnerId,CaseNumber,Contact.Name,Subject,Status,Priority,CreatedDate,Owner.Name,ClosedDate,LastModifiedDate from Case where CreatedDate = THIS_MONTH".

    6. 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.

    7. Back within the Report Table macro, add 11 Report Column macro.
      Set their Titles to "Case #", "Reporter","Subject","Description", "Status", "Priority","Assignee","Created" ,"updated" and "Closed" respectively.

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

    9. Back within the Report Column macro, add a Report Link macro.
      Set its Key parameter to "variable:curpath" and write "%sf:CaseNumber%"

    10. In the "Reporter" Report Column macro, add a Report Info macro.
      Set the Key parameter to "sf:Contact.Name". 

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

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

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

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

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

    16. In the "Created" Report Column macro, add a Report Info macro.
      Set the Key parameter to "sf:CreateDate". 

    17. In the "updated" Report Column macro, add a Report Info macro.
      Set the Key parameter to "sf:LastModifiedDate". 

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

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

  5. Inside the "Unclosed Cases" 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 Id,ContactId,OwnerId,CaseNumber,Contact.Name,Subject,Status,Priority,CreatedDate,Owner.Name,ClosedDate,LastModifiedDate from Case where Status != 'Closed'".

    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 11 Report Column macros.
      Set their Titles to "Case #", "Reporter","Subject","Description", "Status", "Priority","Assignee","Created" ,"updated" and "Closed" respectively.

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

    6. Back within the Report Variable macro, add a Report Link macro.
      Set its Key parameter to "variable:curpath" and write "%sf:CaseNumber%".

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

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

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

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

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

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

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

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

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

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

Macro structure

⚙️ Expand

add NEXT: Creating a dashboard to display Salesforce Opportunities