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 :
Microsoft Dynamics AX (Archived)

How to get field value from FORM?

(0) ShareShare
ReportReport
Posted on by

Hello!

I guess I have a fairly easy question, but I still require assistance...

I have to fill field with values, depending on current data in form, and for that I am writing display method, with select statement, that will fetch the data  I need, but how do I get those values in that FORMS fields.

For better understanding, lets say I have from FORM and fields A, B, C, D

I need to fill field D (display method) with values depending on values in field C.

Thanks you for assistance!

*This post is locked for comments

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    300,714 Super User 2025 Season 2 on at
    RE: How to get field value from FORM?

    Hi MrRobot,

    For normal fields the properties DataSource and DataField are used.

    To display a displaymethod you can use the properties DataSource and DataMethod. So the method name should be entered in the DataMethod property.

    Make sure the display method is or defined on the table itself or a new method on the datasource.

  • Community Member Profile Picture
    on at
    RE: How to get field value from FORM?

    Yes, I know about that - but how can I get the FIELD C value? 

    So, If I add the method to properties and write

    Table table;

    DataSourcetable dsTable; 

    select FIELD from table

    where  table.FIELD1 == dsTable.D; (will this be the fields D value in form ?)

  • Verified answer
    Martin Dráb Profile Picture
    237,660 Most Valuable Professional on at
    RE: How to get field value from FORM?

    Your example isn't clear to me, so let's assume that you have a table called Table1 with a field called FieldC.

    Then write a display method on the table and refer to FieldC as this.FieldC. Do your magic and return some value from the method (which represents D). Bind a form control to this method and you're done.

  • Community Member Profile Picture
    on at
    RE: How to get field value from FORM?

    Thank you!

    That did work!

    but still - if I write display method for datasource (not Table), how can I refer to fields current value?

  • Suggested answer
    Martin Dráb Profile Picture
    237,660 Most Valuable Professional on at
    RE: How to get field value from FORM?

    If you write a display method on a form, you have to pass the current record as a parameter. For example, you get _table1 buffer and refer to the field as _table1.FieldC.

    Note that you typically want display methods on tables, so you can use them in several forms and cache their values (which is important especially if you communicate with database inside the method).

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 3

#3
Willem van Duren Profile Picture

Willem van Duren 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans