Creating a UIBuilder Class in AX with Lookup for SSRS Report
I ran into a scenario where I wanted to filter the dataset of one of the report parameters in an SSRS report in AX. I had a report parameter that had a relation to the DirParty table, so it was returning all records in the DirParty table. I only wanted the sales rep records to appear in the dropdown. To accomplish this I created a UIBuilder class in AX, outlined in the steps below.
The sales responsible field has a tie to the DirParty table. So sales responsible is a recid that pulls in the Name from DirParty table. The problem is that it is pulling all records in from DirParty table, which is confusing for users.
After creating the lookup in the UIBuilder class, the record set return in drop down is limited to only Sales Reps. This makes it much easier for users to select or search for person they want to select.
Create a new UIBuilder class that extends the SrsReportDataContractUIBuilder. Then you will need to create a variable of the Data Contract class that will utilize the UIBuilder.
Next you’ll need to override the build method. Then, add dialog fields of the report parameters in the Data Contract class.
Next you’ll need to override the postBuild method. Create a dialog field and ‘bind’ it to the report parameter you want to put a search on. Then add the lookup method to the dialog field so it will get called.
This is the method that was created to perform the lookup.
Last you will need to change the data contract to make tie to the UIBuilder class.
Under the terms of this license, you are authorized to share and redistribute the content across various mediums, subject to adherence to the specified conditions: you must provide proper attribution to Stoneridge as the original creator in a manner that does not imply their endorsement of your use, the material is to be utilized solely for non-commercial purposes, and alterations, modifications, or derivative works based on the original material are strictly prohibited.
Responsibility rests with the licensee to ensure that their use of the material does not violate any other rights.