Bojensen Blogs

Dynamics AX: Calling a Custom Dynamics AX 2009 SSRS report and passing parameters – From X++

I found this great example on on how to create a simple custom SSRS Report for Microsoft Dynamics AX.

In this example I have created a custom SSRS report for Dynamics AX 2009 instance.

In this you will see I have a Query, that was used for my report, and also a report library I created using Visual Studio 2008 Dynamics AX 2009 Reporting template.

The query, has a Range of SalesId, and in doing that, this was auto added to the report parameters, in the VS2008 projects. (see below image)

This is the name of the parameter in the report def., and therefore important to note for our exercise.

So the task was to take and pass values to reports from X++. I took and create a job that does exactly that. It takes and call my custom reports, output menu item, and pass it a value for the SalesId parameter. The code follows.:

MenuFunction CustRptMI;
Args Args;

CustRptMI = new MenuFunction(menuItemOutputStr(srsCustomRpt),MenuItemType::Output)
Args = new Args();

Notice the name of the parameter is exactly the name it is in the VS2008 project for the report def. ‘qryCustomSSRS_SalesId’. Then simply and = and then . You can add multiple parameters here with commas, and there you have the report being called, ran, and from X++, parameters being passed and the report generated. (See image below)

So as you can see, you can make use of X++ to call custom SSRS reports, pass in paramaters, and do this pretty simply. You just have to know the exactly parameters names, and you can go from there.

Comments are closed.