web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Batch Job to run an SSRS Report

(0) ShareShare
ReportReport
Posted on by 1,447

Hi all,

I want to know how to create a batch job that will run an SSRS report. Can you please explain to me the steps in doing this? Here's what I have so far:

1) A class that extends SysOperationServiceController

2) A class that has the DataContactAttribute for the SysOperationClass

I also need to pass a query or a table buffer to the report controller of the report in the same batch job as well. Please help.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at

    What's the problem? SrsReportRunController already supports batch processing, so you normally don't have to change anything at all. You just switch to the Batch tab in the report dialog and configure recurrence and such things (Print or email a report on a recurring basis).

  • DJRM Profile Picture
    1,447 on at

    What I need to do is send the SSRS report using a class that extends the SysOperationServiceController class. I need to create a batch job programmatically that will run and send the SSRS report. How do I do this in X++?? I look forward for your kind reply. Thank you Martin.

  • Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at

    Don't use SysOperationServiceController. Reports already use SrsReportRunController, which extends SysOperationController. If you don't need any additional logic, you don't even have to override SrsReportRunController, just use the default one.

    Why do you want to create a batch job programmatically? It's highly unusual. Either you want to let a user to configure a periodic batch, or not using a batch and trigger execution on some other event than time.

  • Suggested answer
    venkatesh vadlamani Profile Picture
    3,180 on at

    Add a construct method to controller. This should create a controller class object,set the report name in this method and return the controller object.

    call this method in your sevice controller class.

    Set the appropriate contracts for the report

    Like

    1) RDP contract ( report parameters)

    2) RDL contract (Design parameters)

    3)Print Contract

    The print contract to be definately over ridden as you need to set the destination to anything other than screen .

    now call the startOperation  method. Make a note to set the run on property to called from.

    Regards

    Venkatesh

  • DJRM Profile Picture
    1,447 on at

    Can you explain further Venkatesh? Which Controller should I put the construct method?

  • DJRM Profile Picture
    1,447 on at

    Basically, the user does not want ton configure the batch job, The customer only wants the batch job to run at night time. So I need to create the batch job by X++ manually. How do I do this? All I want to do is create a batch job that will run the SSRS report and send it via email to the customer. The customer doesn't want to see any batch job window or anything, they want this to be all automatic. Thanks Martin.

  • Martin Dráb Profile Picture
    237,878 Most Valuable Professional on at

    So instead of once configuring the report to run every night, the client will pay you to write some code to schedule the batch from code, right? But how will be your code executed? Probably by the same person who doesn't want to set the batch. And how will you handle parameters? Either they will be hard-coded (making the system less useful), or you'll have to duplicate them in another place (so the user would have to do the same work as before, just somewhere else, which doesn't sound useful).

    Can you explain to me what's problem in ticking Batch processing checkbox and setting the recurrence to 1 day? If this configuration is such a big problem, how will you/they want to configure the whole ERP system?

    What Venkatesh described is running a report (once) from code, it doesn't use any batch either.

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi DJRM,

    As martin said, the SSRS reports supports running in batch without any additional code. May be your requirement is not so clear to us, Let me put it simple,

    do you want to generate report for variable parameters, Lets say just for example you want to generate a daily stock report for each of your warehouse. wherein instead of configuring a batch for each warehouse you want to create a batch job that loops through your warehouse and generates report for each WH.

    If your case is something similar, you can create a separate class extending SysOperationsFramework in that you can write your logic to loop through your variable entity (WH for instance) and call SSRS report printing through code.

    Let us know more details about your requirement, then we'll be able to give you a better idea.

  • Suggested answer
    Community Member Profile Picture
    on at

    Create a fully functional report with no error

    Run it

    when you run the report you will get report dialog box

    on report dialog box you will have 'Batch' tab

    on 'Batch' tab click the 'Batch processing' check box

    set the recurrence

    and then click 'OK' button to run the report.

    Please verify and update us if this helps you

  • Suggested answer
    venkatesh vadlamani Profile Picture
    3,180 on at

    Hi,

    I agree with martin . whats the point in adding custom code to do the same thing. So this will add no value to the end user. If user doesn't want to configure the job then get the admin to do it.

    Regards

    Venkatesh

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans