I’ve got a few cloud clients who are have been on classic for a decade, are on the cloud, and looking forward (?) to the classic sunset next year. Part of the issue is they’ve got tens/hundreds of dashboards on their menus, but really no idea what the users are actually using. Of course, if you ask, they’ll say they need all of them.
I put together the following BPM that captures every time someone gets into a dashboard from the menu into a CSV file out in the server folder. My plan is to let this run for 60-90 days, and we’ll find out which dashboards are actually being used.
The BPM is a Post-Processing directive on the BOReader.GetList method, with a condition of "the serviceNamespace argument/variable is equal to the “ICE:BO:DASHBOARD” expression. If that evaluates true, it executes this custom code:
string OutLine = "Company,UserID,TimeStamp,DashboardID\n";
string dashboardID = string.Empty;
string outputDir = @"DashboardLogs";
string outputFile = @"DashboardLogs\DashboardAccess" + DateTime.Today.ToString("yyMM") + ".txt";
// Check for File Path in Company Folder. If it doesn't exist, create it.
var filePathD = new FilePath(ServerFolder.CompanyData, outputDir);
if ( ! this.Sandbox.IO.Directory.Exists(filePathD) )
{
try { this.Sandbox.IO.Directory.CreateDirectory(filePathD); }
catch {
}
}
// Create File Name. If it doesn't exist, create it with header line.
var filePathF = new FilePath(ServerFolder.CompanyData, outputFile);
if ( ! this.Sandbox.IO.File.Exists(filePathF) )
{
try { this.Sandbox.IO.File.AppendAllText(filePathF, OutLine ); }
catch {}
}
// Extract Dashboard from whereClause and write data to log file
OutLine = Session.CompanyID + "," + Session.UserID + "," + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + ",";
try
{
dashboardID = whereClause.SubString(16,100);
dashboardID = dashboardID.SubString(0, dashboardID.Length - 1);
OutLine += dashboardID + "\n";
}
catch {
OutLine += whereClause + "\n";
}
this.Sandbox.IO.File.AppendAllText(filePathF, OutLine );
This writes/appends to a file that can be downloaded using the System Management->Schedule Processes->Server File Download utility. You’ll get a CSV file with the Company ID, User ID, Date/Time Stamp and the Dashboard ID.
Of course, please test and use at your own risk.
