23 March 2016

Clean up your user's reports in their private folders


If I had a nickel for every time an administrator would ask for access to their user's private report folders, I'd have at least $20.45 in my pocket. Just enough to see a movie and buy a small popcorn as I celebrate the awesomeness that is our operational reports team at Salesforce.

A little known but very cool feature with the Spring '16 release is the allPrivate scope within SOQL and the API. If you're an administrator and not sure how to use the API, check out my API First blog post or just try the publicly available workbench tool which makes it easy for anyone to use the API.

The allPrivate query scope enables an administrator to query all reports and dashboards that reside in a user's private folder. As a result, when a user becomes inactive or private reports aren't run for long periods of time, it's possible for an administrator to remove those reports.

There are two simple use cases that illustrate this feature:
1. reports in private folders that haven't been run in the past year
SELECT Name,FolderName,Owner.Name,Owner.isActive,Id,LastModifiedDate,LastRunDate 
FROM Report 
USING SCOPE allPrivate 
WHERE LastRunDate < LAST_N_DAYS:365

2. reports in an inactive user's private folder
SELECT Name,FolderName,Owner.Name,Owner.isActive,Id,LastModifiedDate,LastRunDate
FROM Report 
USING SCOPE allPrivate 
WHERE Owner.isActive = false

Another reason why this feature is at the top of my list for Spring '16 is that it enables Event Monitoring customers to denormalize the names of reports in private report folders. Now when auditing if a report was exported from an inactive user with a report in their private report folder, it's possible for an administrator to pull out the both the report id and the report name using these SOQL queries whereas before, all they got was a report id.

The Spring '16 release is great time for spring cleaning your user's private reports and for auditing which private reports were exported.

No comments:

Post a Comment