Sitecore Advanced System Reporter
I recently found a good, open source reporting framework, ready to install on the Sitecore Shared Source Modules, called Advanced System Reporter.Â
ASR is a framework which allows creating many types of reports in a very short time, such as:
Get the Alias of an Item
Audit users Actions
Find broken links
Find broken link in publishable items
Expired media items
Item History
Items with invalid names
Items with security for an account
Links
Locked Items
Login errors
Logged In users
Multiple Versions
My owned Items
Not recently modified
Orphaned media assets
Owners of items
Workflow history
Items recently modified
Search with regular Expression (regex)
Renderings
Stale workflow items (Items in a workflow status for a long time)
Validation Errors
I will now explain how this module works, how to configure a scheduled task and how to send an email showing the list of items that have been modified during the past week. Install the module
Youâll find a ready-to-use Sitecore module by clicking the link above. You just need to run the installation Wizard (on Sitecore Desktop), upload the zip file and follow the wizard to the end. Keep in mind that according to the moduleâs documentation, this module needs Sitecore CMS V6.0, v.6.4.1, or v.6.5
Setup and test
By default, youâll find a link to the application under main menu Ă All Applications Ă Reporting Tools.
This tool lets you configure, run, export and save previously generated reports. Weâre going to use the report âRecently modifiedâ, so letâs click on the Open button (upper left corner) and select the appropriate item.
We have to choose the root item, usually âcontent\homeâ, because we want to get the modified items. Now just press âRunâ on the top menu bar and there is our list of modified items. If youâre an admin, it is possible to export all that valuable information as a .csv, .xls (or html file, but with a Microsoft Excel extension), or .xml by clicking on the button âExportâ.
Once our report is ready, we only have to save it, so it can be run selecting the parameters manually. But what happens behind the scenes? By default, all the preconfigured items are stored under â/sitecore/system/Modules/ASR/Reportsâ. Now, the application has saved our âreportâ as a child of the â/sitecore/system/Modules/ASR/Reports/Recently Modifiedâ, using the template â/sitecore/templates/System/ASR/Saved Reportâ. So, what weâve saved is not a report, just a âreport parameter setâ associated to a report.
Set up the task to be done by the scheduler
In order to have the schedule execute the task, we need a specific item. The ASR comes with a template to simplify this task under â/sitecore/templates/System/ASR/Report Email Taskâ.
So, letâs select the commands folder under â/sitecore/system/Tasksâ, right click and âInsert Ă Insert from templateâ, on the next window, we have to choose the mentioned item â/sitecore/templates/System/ASR/Report Email Taskâ. We must fill the fields under the âreport Email sectionâ.
Active: If the report must be executed.
To, Subject and text: The properties of the email to be sent.
Send if empty: By default, the application wonât send the email, if after running the report, it returns 0 items. If you want to send the email anyway, mark this option.
Report: Â Here we can choose all the reports we need on the same email. Notice, it will only run âSaved Reportsâ because you canât run reports without parameters.
Save it and the task is ready.
Schedule the task
The specific ASR steps are done. Now we only need to set up the default Sitecore Schedule Item. Select the âSchedulesâ folder under â/sitecore/system/Tasks/Schedulesâ, right click Ă Insert Ă Insert Schedule.
On the Command field, choose the command created in the previous step.
On the Schedule field, we set up when to run the command. This field is a bit strange: I will explain it with an example. In the value ||127|23:59:59 each â|â, is a separator; the first value, is blank and would normally be the first day to run the task in yyyyMMdd format. The second is the last day; again, this is blank because it means the task will be executed indefinitely. The third one is the day of the week, 127 means every day. Why? 1=Sunday, 2=Monday, 4=Tuesday, 8=Wednesday, 16=Thursday, 32=Friday, and 64=Saturday, so everyday =1+2+4+8+16+32+64=127, and the fourth parameter is the minimum interval between invocations. 23:59:59 means once a day. Obviously, the report will not be executed at exactly the same time every day, but this is the best approach. If we try to use 24:00:00, the system will translate it to 00:00:00, so the task will be executed every second. Thatâs it; Sitecore will run the report and send the result via email, once a day.
You can read more about scheduling a task on Sitecore here.
Advanced configuration
At this point, you may have realised that the report will send you the email with the items modified since any given day we chose, but what if we want the items modified yesterday or last week? Well, this is possible too.
We have to modify the âSaved reportâ, so letâs go to: â/sitecore/system/Modules/ASR/Reports/Recently Modifiedâ and click on the item created in step 3. Thereâs only one field, with all the parameters of the report separated by the character â^â. Find the parameter AgeISO and replace the value with one of these variables:
$sc_lastyear
$sc_lastweek
$sc_lastmonth
$sc_yesterday
$sc_today
$sc_now
A framework, why?
The application comes with 23 preconfigured reports, but we can create as many records as we want, adding filters, parameters, scanners, viewers, etc., so we have the tools to easily create our own custom report. How do you do this? Well, maybe this is for another blog post.
Some reports are not working: why?
First, check your logs and look for something like âWARN ASR: cannot assign value to propertyâŚâ. If you find this error youâre lucky since these errors are easy to fix.
The module is using Sitecore utilities to set the attributes of the different configuration items as filters, scanners, etc. Those elements have the assembly, class and attributes, configured on Sitecore fields for this purpose. Â
If you open the filter /sitecore/system/Modules/ASR/Configuration/Filters/Audit, youâll see the field âAttributesâ, with this value: âverb={Verb}|user={User}â. This means that the code is going to try to set the attribute âverbâ and the attribute âuserâ, of one object of type âAuditFilterâ (namespace: ASR.Reports.Logs), but if you check the code (Downloading the code, or with a decompiler like âTelerik just decompileâ), youâll see that this type has two properties: âVerbâ and âUserâ. So, as you would expect the method âSitecore.Reflection.ReflectionUtil.SetPropertyâ is not able to find the property âverbâ and âuserâ.
The solution: edit the âattributesâ field in the sitecore item, change the first letter of the parameters to uppercase and save. Your report will now run properly.
Feel free to ask me any questions or leave me a comment in the box below.
Contributed by: Vicent Galiana










