Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to trigger a SSRS Subscription based on an event?

Is there a way by which I can trigger a SSRS subscription (Time based) whenever there is an event like file created in a shared folder? Can we do it with powershell or C#?

Is there a out of box feature available in SSRS (though I don't think there is any)?

I am using SQL Server 2008 R2.

like image 920
AJ01 Avatar asked May 28 '15 09:05

AJ01


1 Answers

Yes, we do something like this here. You can use the FireSubscription function of the Reporting Services web services to trigger a subscription. Here's a detailed explanation of how to set it up:

Firing a Reporting Services Subscription

You can use the FileSystemWatcher to tell when your file is dropped and then fire the subscription off. It's asynchronous though so you don't get notification if the report was sent successfully... only that it was successfully queued up. Also you first modify the parameters of the subscription before you fire it, so you have to make sure that you don't have more than one program to trigger the subscription or it might end up tripping over itself.

Another slightly more complicated way to do it is to use the Render function to generate a report and then have your program manage the emailing.

Render Function

This way you don't have to create a dummy subscription and you'll know immediately if it was sent successfully with the correct parameters.

One final note... if you have the Enterprise Edition (which you probably don't), it comes with Data Driven Report Subscriptions, which you could use to trigger a subscription:

Creating a Data-Driven Subscription

like image 76
Brian Pressler Avatar answered Oct 11 '22 04:10

Brian Pressler