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, ...
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;
}

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,162 Moderator on at

    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.

  • Ram Kumar Profile Picture
    454 on at

    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,162 Moderator on at

    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

    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,162 Moderator on at

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

  • Ram Kumar Profile Picture
    454 on at

    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,162 Moderator on at

    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.

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