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

Notifications

Announcements

No record found.

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)
  • Verified answer
    Martin Dráb Profile Picture
    237,976 Most Valuable Professional on at

    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.

  • FlorinF Profile Picture
    on at

    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
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    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

    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,423 on at

    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

    Hi ,

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

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 429 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans