Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

autofill rest of the fields based on one field.

Posted on by Microsoft Employee

i have a field Id ..... and on filling this field ....i want to autofill the name and address field of the table depending upon the id . how to do that?

regards
rajesh

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: autofill rest of the fields based on one field.

    Hi Chaitanya,

    Can you help me provide path address for modifiedField for the same example on Table Level ?

    Thanks in advance for the help.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: autofill rest of the fields based on one field.

    Hi Chaitanya, can you help me provide path address for modifiedField for the same example on Table Level ?

    Thanks in advance for the help.

  • Verified answer
    Rohin Profile Picture
    Rohin 4,624 on at
    RE: autofill rest of the fields based on one field.

    does name field is display method?

    1. if so, then its pretty simple call this method in field datasource modified() , like below:

    public void modified()
    
    {
    
       table_ds.cacheCalculateMethod(tableMethodStr(tableName,MethodName));
    
       super();
    
    }

    2. If it is table field not display method, then simply do like below :
    table.name = custTable.Name();


  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: autofill rest of the fields based on one field.

    Hi chaitanya,

    i am confused.

    my requirement :

    i have two fields customerId(EDT--custaccount) and name.

    customerId is a lookup field which shows the id and name . i want the name field to be autofilled whenever i choose the id from the lookup.

    regards

    rajesh

  • Suggested answer
    Rohin Profile Picture
    Rohin 4,624 on at
    RE: autofill rest of the fields based on one field.

    You can find plenty of examples in AX for this. For Instance, create a method "initFromTableA" , here initialize all your table fields from another table and call this method on modified() method of field.

  • Suggested answer
    Chaitanya Golla Profile Picture
    Chaitanya Golla 17,225 on at
    RE: autofill rest of the fields based on one field.

    Hi,

    You can refer the modified method of field CashDisc on the salesTable form

    Path: \Forms\SalesTable\Data Sources\SalesTable\Fields\CashDisc\Methods\modified.

    If its not clear, you can provide us your requirement will work on it and update you.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: autofill rest of the fields based on one field.

    can u help me with the code in modified() in datasources???

    regards

  • Suggested answer
    Chaitanya Golla Profile Picture
    Chaitanya Golla 17,225 on at
    RE: autofill rest of the fields based on one field.

    Hi,

    You can include your code either on the modifed method of Id field at the datasource level (or) in the modifiedField method on table level (with a case for Id) to have this defaultings.

    Path: \Forms\<FormName>\Data Sources\<TableName>\Fields\Id\Methods\modified.

    Code could be: 

    Table_ds.Address = "XYZ";
    Table_ds.Name = "123";

    Path: \Data Dictionary\Tables\<TableName>\Methods\modifiedField

    Code could be: 

    case fieldNum(TableName, Id):
                    this.Address = "XYZ";
                    this.Name = "123";
                    break;

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans