I was getting following error during customization of Dynamics AX.
After some debugging i found that it is due to model. Error can be resolved by updating model. In this blog i am working with smmActivities but it can applied for any table.
Goto your table in AOT you will see model name in square brackets in light color grey. You have to add this model to resolve issue. In my case model name is “Case Management”.
In toolbar go to Dynamics 365 →Model Management → Update model parameters.
Select your model in which you are doing your customization, in my case it is “testModel” and click on next, scroll down and select “Case Management” and select next and then click on finish.
A common error in Microsoft Dynamics 365 for Finance and Operations reporting is data set execution problem. It usually occurs after adding another data set to your existing report. The problem is due to caching of previous report state in different programs. One of the following solutions will work for you: Solution 1- Restart report service1.1 Open reporting server configuration
1.2 Stop and then start the reporting service
Solution 2- Delete the cached RDL file, clear your usage data and build report again 2.1 Open the reporting server configuration
2.2 In the Web Portal URL you can see an URL click on it, it will redirect you to reporting web portal home page. In case you are unable to click the URL click the ‘Apply’ button in the footer to enable the URL.
2.3 Delete the report RDL file.
2.4 Clear your usage data from AX -> Settings -> User options -> Usage data -> Reset2.5 Build and deploy your report again.
If you want to use wildcards in an AX X++ select statement (*), you will have to use the LIKE command. The following select statement will find all captions in the batch tasks (BatchHistory) table.
For x++ select statements: select firstOnly batchHistory where batchHistory.Caption LIKE “*Test*”
For x++ queries: queryBuildRange.value(*Test*);
Note the LIKE instead of a ‘==’ and the wildcards inside of the quotations. All other combinations of wildcard usage will work here. This is the same functionality as what the users would put in the grid filtering(eg. ‘*TEST*’ in the caption field filter on the batch tasks form).
However, if you want to find all Captions that do not have the word Test in them (NOT LIKE, !LIKE), you will have to modify the above example slightly.
For x++ select statements: select firstOnly batchHistory where !(batchHistory.Caption LIKE “*TEST*”);
Controller class is used to control the report execution as well as preprocessing of the report data. The SSRS reporting framework uses this class to modify the report dialogs, calling the SQL Server reporting services, as well preprocessing parameters for the report.
Following are the scenarios where Controller class can be used:
Modifying a report query based on the input data
Modifying report contract data based on the input data
Control a report parameters dialog
Open different reports/designs from the same menu item based on the input data
Reports that are opened from a form
To create a controller class, extend it with SrsReportRunController.
Prerequisites
Microsoft Dynamics AX 2012
Reporting services extensions must be installed in Dynamics AX
Sample Controller Class
Create a new class. Open AOT → Classes
Right Click on Classes and select New Class. Name it as SSRSDemoController.
Open the Class declaration by right clicking on it and selecting View code.
Now write the following code:
class SSRSDemoController extends SrsReportRunController
{
}
Create a new method and write the following code:
public static client void main(Args args)
{
//define the new object for controller class
SSRSDemoController ssrsDemoController;
ssrsDemoController = new SSRSDemoController();
//pass the caller args to the controller
ssrsDemoController.parmArgs(args);
//set the report name and report design to run
ssrsDemoController.parmReportName(ssrsReportStr(SSRSSessionQuery,Design));
//execute the report
ssrsDemoController.startOperation();
}
Examples of Controller Class Usage
Based on different scenarios, different methods are overridden as shown in the following examples:
Modifying report query based on the input data
Used in those scenarios where a report query needs to be modified based on the caller args parameters or recorded before the report parameter dialog is rendered.
Override prePromptModifyContract method to modify the report query as shown below:
public void prePromptModifyContract()
{
//add a range in the report query
SrsReportHelper::addParameterValueRangeToQuery(this.getFirstQuery(),tableNum(SSRSReportDemo),fieldNum(SSRSReportDemo, RecId),SysQuery::value(this.parmArgs().record().RecId));
}
Note: prePromptModifyContract is called by report controller before the parameter dialog is shown to the User.
Modifying report contract data based on the input data
Used in those scenarios where report contract parameters need to be modified based on the caller args prior to the execution of the report.
Override preRunModifyContract method to modify the report contract as shown below:
protected void preRunModifyContract()
{
//define object for report contract
SSRSDemoContract contract;
//get the reference of the current contract object
contract = this.parmReportContract().parmRdpContract() as SSRSDemoContract;
//modify the parameter value of the contract
contract.parmType(this.parmArgs().parm());
}
Note: preRunModifyContract is called by report controller before the report is run.
Control report parameters dialog
In some scenarios, a report parameter dialog should not be visible to the end user. Controller class is also used to control the visibility of the report parameter UI.
Add the following code in the main method of the controller class before startOperation method call to hide/show the report parameter UI:
//hide the report parameter dialog
ssrsDemoController.parmShowDialog(false);
Open different reports from the same menu item based on the input data
It is used in those scenarios where different reports or different designs of a same report need to be opened from a same menu item depending upon the caller args.
Write the following code in main method to achieve this scenario:
public static client void main(Args args)
{
//define the new object for controller class
SSRSDemoController ssrsDemoController;
ssrsDemoController = new SSRSDemoController();
//pass the caller args to the controller
ssrsDemoController.parmArgs(args);
//if report is run from edit mode then run the EditDesign of the report otherwise run the NewDesign of the report
if(args.parmEnum() == FormOpenMode::ForEdit)
{
//set the report name and report design to run
ssrsDemoController.parmReportName(ssrsReportStr(SSRSSessionQuery,EditDesign));
}
else
{
//set the report name and report design to run
ssrsDemoController.parmReportName(ssrsReportStr(SSRSSessionQuery,NewDesign));
}
//execute the report
ssrsDemoController.startOperation();
}
Reports that are opened from a form
Controller class is also used when reports are opened from a form and are needed to show selected record details.
Use either prePromptModifyContract method or preRunModifyContract method to achieve this scenario.