To report on audited records you can either create a report based on Audit Records or use a report based on another object type, such as Opportunities, and link to audit information. (To find audit information use the breadcrumb on More Columns.) For more information on Audit in general, click here.
Below are some examples of Audit Report that you might find useful. Reporting is not limited to these examples and you may have other reporting requirements.
Report to show which records were deleted last week
This is a simple list report, showing as many columns as you want, with criteria applied to narrow down which records are returned.
- Create a new report based on Audit Records and give it a name.
- Add columns for: Action; Record Type; Reference; User Name and any other columns you might be interested in.
- Add a criterion to show only those records where the Action is delete.
- Add a second criterion to show only those records that were deleted last week. To do this, click Add criteria from Audit Records. Using the dropdown picklist select More Columns, then select Date. Apply an Operator of 'is in calendar range' and use the Calendar range picklist to select last week.
The resulting report will look something like the one in the screenshot below. Notice that there are multiple rows for the same request (eg, request 16,602, which is highlighted). This is because the single action of deleting a record also deletes all the relationships that existed between that record and others on your database. If you simply want to see which records (rather than relationships) have been deleted you can add a criterion to remove any rows where the Reference is blank.
Report to show how many Opportunities have been won this quarter
This report calculates how many Opportunities have been won this quarter, summarised by salesperson. It assumes that the Assigned To field is used to capture the salesperson's name and uses audit to identify the date that an Opportunity changed to Stage 5 - Closed Won, regardless of what stage it was at previously. You probably use different Opportunity Stages to identify won deals, but the same theory can be applied.
- Create a report based on Opportunities and give it a name.
- Add a column for: Salesperson (Assigned To). Add a calculated column to count the number of Opportunities moved to Stage 5 using the following formula: count(id)
- Add a criterion to limit the report to records where the field's new value is Stage 5 - Closed Won. (To do this, choose More columns > Audit records > Field Changes > New Value; add an Operator of 'is' and add Stage 5 - Closed Won to the text field.)
- Add another criterion to limit the report to those records where the Opportunity was moved to Stage 5 in the current calendar quarter.
- Finally, summarise the report by Salesperson to give you one row per person, as shown below.
Report to show how long a record has been in its current state
Imagine that you have a Case status value of In Progress and you want to build a list report showing how long the Cases that currently have an In Progress value have been in that state.
NOTE: You might also want to report on how long a record spent in a state, regardless of whether or not it's still in that state. This requires a different report - see our forum post on how to build this.
There are several aspects to this report; you need to limit the results to those records that currently have a status of In Progress. In addition, you also need to limit the results to those where the change to the record was to change the Status to In Progress (irrespective of what the Status was prior to this). Once you have this subset of data, you want to identify the most recent time that the Status changed to In Progress (because in theory it could move in and out of this Status multiple times), and then calculate the time difference between now and when it was most recently changed to In Progress. Finally, you will need to summarise the report to make sure you're only looking at one row per Case.
Begin by creating a report based on Case records.
Next, apply the criteria you want to use to narrow down the results. (Because auditing logs every change to a record, the resulting reports may contain a large volume of data. For this reason we recommend that you apply your criteria before adding any calculated columns to limit any delays in displaying the report.)
- Add a criterion to show records for which the Status is In Progress.
- Add a second criterion to identify Cases where the audited change shows that the new value in the Status field is In Progress. (To do this, open the Criteria tab, click Add criteria from Cases, choose More columns > Audit records > Field Changes > New Value, apply an Operator of is and enter In Progress in the Text box.
- Add a column for the Case number (which is the Object Reference).
- Add a calculated column to show the most recent time that the Status field was changed to In Progress by using the following formula:
- Add a calculated column to display the difference in days between today (now) and the date that the record was changed by using the following formula:
DATEDIFF(curdate(), MAX( audit_records.fields.created_at))
You don't need to keep the column that calculates the most recent time the Status field was changed so you can delete it or hide it.
If you click Refresh preview you'll see that the report shows just one row of data. This is because the results have been aggregated as a result of using the MAX function. To see individual records, open the Summarise by tab and summarise by the Object reference.
Your resulting report should look something like the one below (click to enlarge).