Wednesday, November 5, 2008

Subscription is Disabled When User!UserID Global Variable is Used in SSRS Report

I recently had a problem where I was unable to create a data-driven subscription for a SQL Server Reporting Services report.  I opened SQL Server Management Studio, connected to Reporting Services, navigated to a report, then right clicked on it's Subscriptions node and both the New Subscription and New Data-Driven Subscription menu options were grayed out.

NoSubscriptions

The report in question had five parameters that the users could enter at runtime.  I wanted to implement the data-driven subscription to execute the report with all possible combinations of the parameters in order to get every possible version of the report to be cached.  Since the data for the report was only refreshed once a week, this seemed like a good idea.

I eventually found the answer in Books On Line.  Subscriptions are disabled when you use the User!UserID global variable.  The User!UserID global variable contains the domainusername of the user running the report.  In my case I used the User!UserID global variable to filter the various dropdown lists for parameters so users could only run the report for specific regions and/or offices that they are allowed to see.

No comments: