Good luck!
Dynamics AX solutions for issues I encounter as I develop for Dynamics AX - now Dynamics 365 Finance & Operations
Friday, October 30, 2020
Designing SSRS reports easier
Good luck!
Thursday, October 22, 2020
AX SSRS Report - How to modify parameter properties based on usage data values
I have a report type parameter that determines which parameters the report needs to run.
I created a new enum for the Report type, available options are Job Number or Invoice Number.
If the job number is selected there will be a start job number and end job number with labels "Starting number" and "Ending number." If Invoice Number is selected there will be a start invoice number and an end invoice number with the exact same labels.
Since the job number is the first enum, I decided to build the parameters as if Job number were selected. However, if the user selects invoice number and that is stored in usage data, the parameter screen would need to accommodate that and show the correct parameters based on the invoice number report type selection.
I created a UI Builder class to accomplish this. My report is already using a contract class to define the 5 parameters I need for the report, a controller class, and a DP class to process the report. In the build() method of the UIBuilder class, I add all the dialog fields I will need and then I set visible = false for the invoice start and end fields.
In the postRun() method (before the super()), I check the value of the reportType enum. PostRun() gets called after the usage data is stored in the field(s). If the reportType is InvoiceNumber, I set the jobstart/end fields to visible = false and the invoicestart/end fields to visible = true.
This works nicely.
I also had to override the modified method of the reportType parameter in order to change the parameters shown when the user modifies the report type. For this, I used the postBuild() method tell the system to override the modified() method and where to go to find the new logic for this method.
Ensure that you use the right form control for your field type. For example, my enum reportType is a comboboxcontrol. If your field is a string, you would need a FormStringControl. If your field is an Int you would need a FormIntControl, etc. Your modified() method will need to pass that same type of control as well.
Good luck!
Tuesday, July 21, 2020
D365 Visual Studio Application Explorer filters
Everyone should know that you can use: type:"form" to only find form type elements but if you add regular expressions to it, you can greatly limit the results returned.
For example, you can add: List$ to find only forms that end in the word List or you can add: ^Cust to only find forms that start with Cust.
My favorite is to find objects that start with one word (often the prefix we are using for customizations) and ends with another word. For example, to find all objects that start with MCA and end with the word TEST you can do: ^MCA.*Test$
I use this every single day!
Happy coding!