web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Creating display methods for form extensions

(0) ShareShare
ReportReport
Posted on by 692

Hi all

I have a requirement to add a display method to the MCRSalesQuickQuote form that displays the the product name in the language that is set on the SalesTable table if the form is called from the SalesTable form. I am using the latest version of AX and am extending rather than overlaying the form.

The way that I would do this in 2012 would be to declare a LanguageId as a global variable in the form which is initialised in the init method. Then I could reference this in a display method on the form datasource.

When an extension of the form MCRSalesQuickQuote is created it is not possible to create a display method on the form datasource.

Is there a way I can achieve this? Is it possible to reference the calling form some how if I put the display method on the table?

Thanks,
Joe

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Mea_ Profile Picture
    60,286 on at

    Hi Joe Brewer,

    Did you try to use extension classes ax.help.dynamics.com/.../class-extensions ?

    Using it you can add state to a from (variable) to cache whatever you want, here is an example community.dynamics.com/.../code-behind-extension-forms-how-to-add-state-variable-and-override-methods-without-overlayering

  • Martin Dráb Profile Picture
    240,045 Most Valuable Professional on at

    I agree with Ievgen's suggestion. Nevertheless you don't actually have to store the language in a variable, have you? You could take the value from args every time.

  • JoeBrewer Profile Picture
    692 on at

    Thanks for the replies.

    How do I reference args in the static display method in the form extension class?

    Joe

  • Martin Dráb Profile Picture
    240,045 Most Valuable Professional on at

    Easily - you get the form as the first parameter, therefore you can simply call its args() method. But if you use an extension class instead of the extension method (refer to Ievgen's links), you can simply refer to 'this' (the method won't be static, because you're adding an instance method).

  • Michael Paul Profile Picture
    on at

    How are you passing this?

    Lets say you have the base D365 form SalesTable.  You add a form extension SalesTable.Extension.  In SalesTable.Extension you add two form controls.  One form control is a drop down enum with no table ds behind it, and the other is a string control in the sales lines grid populated by a display method with conditional logic based off of the aforementioned drop down control and the SalesLine table buffer.

    When you create the display method on a table extension class, you can only pass the SalesLine table buffer.  If you put a display method in a form extension class, when you configure the DataSource and DataMethod properties on the form control in the extension, it won't be found.  If you put in your form extension class display method anyway, and do not populate the DataSource, the compiler will say the method can't be found on the form.  

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans