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

december

02dec9:00 am12:00 pmOnline Workshop - Dynamics GP Year End Close (Morning Session)

03dec11:00 am12:00 pmConfab with Stoneridge - Livestream: Live Agents, Power Virtual Agents, Omnichannel – Oh My!

03dec1:00 pm4:00 pmOnline Workshop - Dynamics GP Year End Close (Afternoon Session)

09dec10:00 am10:30 amThe Modern Manufacturer - Manufacturing Policy Management

17dec11:00 am12:00 pmConfab with Stoneridge - Livestream - Technology in 2020: A Year in Review

january

06jan10:00 am10:30 amThe Modern Manufacturer - MRP v MPS – What, When and How

14jan11:00 am12:00 pmConfab with Stoneridge - Livestream - Looking Forward: Predictions for Technology in 2021

20jan10:00 am10:30 amThe Modern Manufacturer - Demand Forecasting Functionality

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