Archive for July, 2015


Hi All,

Today, I was getting below error while running the batch class as a batch job in AX 2012:

Unable to construct an object from the class “MyClassName” in the batch framework. Make sure that the X++ code has been compiled to Microsoft .NET Framework CIL, and that the constructor does not require any parameters

All the solutions I found was suggesting to perform either incremental or full CIL, but it didn’t resolve the issue in my case. Then I restarted all the AOSes for my environment and voila, the error was gone.

So, if you get this error and incremental or full CIL doesn’t resolve the issue for you, then try restarting all the AOSes.

Thanks,

Baber.

Recently I had a requirement to hide report parameters from report dialog based on the caller menu item. So here is how to do it. I will show you the example of production picking list report. Production picking list report in AX 2012 feature pack version has the following report parameters:

Image1

There are three parameter groups on the report dialog above which are as follows:

  • Parameters
  • If connected to purchase order
  • View

And below is the classDeclaration of the contract class, as shown below:

Image2

The View group fields comes from InventDimViewContract class which is added as a parm method in ProdPickListContract class to show the options for all inventory dimensions.

Suppose, we want to hide all the parameter groups from report dialog and just want to display the dynamics filters on the report. You need to modify the UIBuilder class of your report. For production picking list report, the UI Builder class is ProdPickListUIBuilder. The build method needs to be modified and the code in Bold below can be used to hide the whole parameter group from SSRS report dialog:

public void build()

{

FormBuildGroupControl grp;

grp = this.dialog().curFormGroup();

grp.frameType();

grp.columns(2);

if (this.controller().parmArgs().menuitemName() == #yourMenuItemName)

     {

           grp.visible(false);

     }

super ();

}

Below is the output, after hiding the whole parameter group:

Image3

To hide the dynamic filters from SSRS report dialog based on caller menu item, you need to override the following method in your controller class and return false from this method based on your condition:

showQueryValues

Override this method in your controller class and write the following code:

public boolean showQueryValues(str parameterName)

{

If (this.parmArgs().menuItemName() == menuItemOutputStr(#YourMenuItemName)

{

return false;

}

else

{

return true;

}

}

You will see the following output when the report is run:

Image4

Only the Printer and Print destination options will be shown which is displayed by default on the reports.

Enjoy reporting.