Creating a UIBuilder Class in AX with Lookup for SSRS Report

by | Updated August 15, 2016 | Development, Dynamics AX, Reporting

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.

Commission Summary

 

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.

Commission Summary in AX 2012

 

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.

UIBuilder Class in AX

 

Next you’ll need to override the build method. Then, add dialog fields of the report parameters in the Data Contract class.

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.

Commission Summary UIBuilder

 

This is the method that was created to perform the lookup.

Commission Summary UIBuilder

 

Last you will need to change the data contract to make tie to the UIBuilder class.

UIBuilder Class

Related Posts

2 Comments

  1. Qaiser Siddique

    i followed all the steps , code is ok shows no error but on report parameter form when i select the parameter i get this error.

    Error executing code: FormStringControl (object), method Lookup called with invalid parameters.

    Stack trace

    (C)\Classes\FormStringControl\Lookup

  2. Brandon Carmichael

    Hello Qaiser:

    I tried to recreate the issue you describe, but I have not been able too. As such, I would suggest do a CIL build, clear cache(s), etc… I don’t believe it is report related but it wouldn’t hurt to refresh the dataset, followed up with a rebuild and deploy of the report. Does the parameter exists in the contract class?

    If my suggestions above do not work, we will need some more info. But my guess would be there may be an issue in the custom lookup method.

    Thanks,
    Brandon

Submit a Comment

Your email address will not be published. Required fields are marked *

Upcoming Events

march

03mar10:00 am10:30 amThe Modern Manufacturer - MRP vs. MPS – What, When and How

03mar2:00 pm2:30 pmLot Management Best Practices for Batch Manufacturers

10mar10:00 am10:30 amEnhancing the Customer Experience and Driving More Business with Dynamics 365 Customer Service

10mar2:00 pm2:30 pmThe Five Steps to Managing Sales Tax for Manufacturers

11mar11:00 am12:00 pmConfab with Stoneridge - Livestream - Power Apps Component Framework Power Hour

17mar10:00 am10:30 amThe Modern Manufacturer: Pro Tips for your Finance Team

24mar10:00 am10:30 amUnlock the Potential of Digital Marketing with Dynamics 365 Marketing

25mar11:00 am12:00 pmConfab with Stoneridge - Livestream - The Four Keys to Choosing the Best ERP or CRM Solution

31mar10:00 am10:30 amThe Modern Manufacturer: Keys to Reporting Success

31mar01aprTraining Class: Financial Reporting W/Account Schedules for Dynamics 365 Business Central

april

31mar01aprTraining Class: Financial Reporting W/Account Schedules for Dynamics 365 Business Central

07apr10:00 am10:30 amBoost Seller Productivity and Close More Business with Dynamics 365 Sales

07apr2:00 pm2:30 pmEnsuring Quality for Batch Manufacturers

08apr11:00 am12:00 pmJumping into the Deep End of the Data Lake

14apr10:00 am10:30 amThe Modern Manufacturer: Cost Accounting in D365

22apr11:00 am12:00 pmMoving from Manual to Automated with Strategic Automation Strategies

28apr10:00 am10:30 amThe Modern Manufacturer: Best Practices for Inventory Turn

About Stoneridge
Stoneridge Software is a unique Microsoft Gold Partner, with emphasis on partner. With specialties in Microsoft Dynamics 365, Microsoft Dynamics AX, Microsoft Dynamics NAV, Microsoft Dynamics GP and Microsoft Dynamics CRM, we focus on attracting the most knowledgeable experts in the field to our team, and prioritize delivering stellar solutions with maximum impact for your business. At Stoneridge, we are deeply committed to your results. Each engagement is met with a dedicated team, ready to provide thorough, tailored, and expert service. Based in Minnesota, we intentionally “step into your shoes,” wherever you are. We focus on what you care about, and develop trusting, long-term relationships with our clients.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!

X