The other day I had to convert a custom query-based SSRS report within Dynamics AX 2012 into a regular report so that we could run the report from a different form (ProdTable & ProdTableListPage) and have certain values auto-populate the query prompt. Normally something like this would be easy to implement, however, I ran into some issues when making the modifications.
I created the data provider, Contract and Controller classes, and the dialog values were not changing. I ended up building a UI Builder class as well to counteract this issue. I had the logic to pre-populate the contract in the controller class by using the record that was highlighted, and I verified that the values were being pulled into the contract class as desired. I then stumbled across the issue of the UI Builder class was not using the same contract instance as the Controller & Data Provider classes. This was resulting in the values not populating the prompt and was not being passed to the Data Provider class. What I wound up having to do is to move my logic into the UI Builder class. Below I have provided the code I created in order to utilize this.
Controller main method:
public static void main(Args _args)
SSI_DemoController controller = new SSI_DemoController();
SSI_DemoContract contract = new SSI_DemoContract();
The rest of the logic had to be put into the UI Builder class, specifically the build method.
public void build()
controllerDlg = this.controller();
contract = this.dataContractObject();
args = controllerDlg.parmArgs();
if(args.record() && args.record().TableId == tableNum(ProdTable))
prodTable = args.record();
printSettings = controllerDlg.parmReportContract().parmPrintSettings();
if(contract.parmNumberOfCopies() != 0)
dlgItem = this.addDialogField(methodStr(SSI_DemoContract,parmItemId),contract);
dlgItem = this.bindInfo().getDialogField(contract,methodStr(SSI_DemoContract,parmItemId));
This code was able to solve the issue I was having and should help you if you’re facing the same problems. Learn more tips for Dynamics AX 2012 by subscribing to our blog. If you have any questions in the meantime, please reach out to the experts at Stoneridge Software.