Skip to main content

Notifications

Announcements

No record found.

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

  • Michael Paul Profile Picture
    on at
    RE: Creating display methods for form extensions

    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.  

  • Martin Dráb Profile Picture
    234,599 Most Valuable Professional on at
    RE: Creating display methods for form extensions

    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).

  • JoeBrewer Profile Picture
    692 on at
    RE: Creating display methods for form extensions

    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
    234,599 Most Valuable Professional on at
    RE: Creating display methods for form extensions

    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.

  • Verified answer
    Mea_ Profile Picture
    60,278 on at
    RE: Creating display methods for form extensions

    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

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Kempeth Profile Picture

Kempeth 4

#1
Andy Adamak Profile Picture

Andy Adamak 4

#1
Community Member Profile Picture

Community Member 4

Featured topics

Product updates

Dynamics 365 release plans