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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Is it possible to add a display method in form datasource through extension?

(0) ShareShare
ReportReport
Posted on by

Hello.

Is it possible to add a display method in a form datasource through extension and then use it as a data method on new control added to the same form (through extension)  ?

Example:

[ExtensionOf(formDataSourceStr(formname,formdatasourcename))]
final class ABCDatasource_Extension
{
     public display str showString()
    {

       return "test" ;
    }
}

Then I add new string control to the "formname" by creating an extension of the form. I want to use showString display method as a data method for this control.

I'm getting compilation error: the method doesn't exists.

I try to use COC as much as possible and to avoid static methods.

There is similar discussion here :https://community.dynamics.com/365/financeandoperations/f/dynamics-365-for-finance-and-operations-forum/311051/can-i-add-a-new-display-method-under-a-datasource-of-a-form-extension/, but It's an old thread.

Thank you.

I have the same question (0)
  • FlorinF Profile Picture
    on at
    RE: Is it possible to add a display method in form datasource through extension?

    Hi ,

    After full model build, the method is displayed in the drop down as : InventOnhandItem_FormDataSource_Extension.expirationDate

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: Is it possible to add a display method in form datasource through extension?

    It had worked for me a couple of weeks back when it showed the data method in the drop down. Could you try doing a build of your Dev model and check if that gets the drop down working?

  • FlorinF Profile Picture
    on at
    RE: Is it possible to add a display method in form datasource through extension?

    Hi Gunjan,

    It's working if you provide the full path to the method as you said : InventOnhandItem_FormDataSource_Extension.expirationDate

    I was expecting to see the method in the drop down, but it's not listed

    Thank you.

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: Is it possible to add a display method in form datasource through extension?

    Hi FlorinF,

    You should be able to choose the data method from the drop down. You can try this value as well - InventOnhandItem_FormDataSource_Extension.expirationDate

  • FlorinF Profile Picture
    on at
    RE: Is it possible to add a display method in form datasource through extension?

    Hi Martin ,

    I have the following code :

    [ExtensionOf(formDataSourceStr(InventOnhandItem, InventSum))]

    final class InventOnhandItem_FormDataSource_Extension

    {

       display date expirationDate(InventSum _inventSum)

       {

           return today();

       }

    }

    pastedimage1615066181035v1.png

    The error is :

    Severity Code Description Project File Line Suppression State
    Error Path: [AxFormExtension/InventOnhandItem.xx/Controls/FormExtensionControlk0ln0vls1/ExpirationDate/DataMethod]:The data method 'expirationDate' was not found on the data source 'InventSum' or its base table/view. 

    My version is:

    Application release

    Microsoft Dynamics 365 for Finance and Operations (10.0.15)

    Platform release
    Update39 (7.0.5816.41512)
    Thank you.
  • Verified answer
    Martin Dráb Profile Picture
    235,914 Most Valuable Professional on at
    RE: Is it possible to add a display method in form datasource through extension?

    If I'm not mistaken, it's supported now, although it wasn't possible in some older versions of D365FO.

    Neverthelss your method isn't correct - if a display method isn't on a table, it must take a table buffer as the parameter.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 764 User Group Leader

#2
Martin Dráb Profile Picture

Martin Dráb 619 Most Valuable Professional

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 603 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans