Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Display method in Formdatasource

(0) ShareShare
ReportReport
Posted on by 454

Hi,

I am new to AX , I have to add one display field ( Customer Account)  in Salestable form . I have written code in Salesline FormDatasource but it returns an error 

"Error executing code: FormDataSource (data source), method displaycustacnt called with invalid parameters". Here is my code 

display CustAccount displaycustacnt(SalesTable  _salestable)
{

    SalesLine           salesline1;

    select CustAccount from salesline1 where Salesline1.SalesId == _salestable.SalesId;
    return salesline1.CustAccount;
}

  • Suggested answer
    nmaenpaa Profile Picture
    101,158 Moderator on at
    RE: Display method in Formdatasource

    Hi Ram,

    it's not possible to filter by display fields. You need to have a physical field in order to do filtering. This is because the value in display field is calculated only when it's displayed on your screen. If you have 10 000 records in your table, only 20 display field values are calculated if you see 20 records on your form. So, the system doesn't know the values of the remaining 9 980 display fields and it's not possible to do any filtering.

    If you have some specific business requirement, don't hesitate to share it with us. Perhaps we can propose a solution.

  • Ram Kumar Profile Picture
    454 on at
    RE: Display method in Formdatasource

    Hi Nikolaos,

    Thanks it worked, and also i have to set the filter by field and filter by selection options in it.

    Regards,

    Ram

  • Suggested answer
    nmaenpaa Profile Picture
    101,158 Moderator on at
    RE: Display method in Formdatasource

    You can override jumpRef method to add "View details" for your field.

  • Ram Kumar Profile Picture
    454 on at
    RE: Display method in Formdatasource

    Hi Nikolaos,

    I said for an example. Is there any way to achieve view details option in the display field.

    Regards,

    Ram

  • Suggested answer
    nmaenpaa Profile Picture
    101,158 Moderator on at
    RE: Display method in Formdatasource

    Hi Ram Kumar,

    as I already wrote, you don't need a display method to show CustAccount of SalesLine in SalesTable form. Instead of using a display method, set these properties on your field:
    - Data source: SalesLine

    - Data field: CustAccount

    You should only use display methods when you want to display some value which is not directly present in the form data source tables.

    And the "View details" will also work with this approach. Although I think it should work also if your display method's return type is CustAccount. 

  • Ram Kumar Profile Picture
    454 on at
    RE: Display method in Formdatasource

    Hi Nikolaos,

    Thanks it works. I have to add view details option for that display field. help me on this

    Regards,

    Ram

  • Suggested answer
    nmaenpaa Profile Picture
    101,158 Moderator on at
    RE: Display method in Formdatasource

    If the display method is added to SalesLine data source, then the parameter must be of type SalesLine.

    But I don't understand the purpose of this display method. You can just show SalesLine.CustAccount directly on the form, no need for display methods.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,125 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,871 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans