Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

AutoPopulating a field upon entering another field.

Posted on by Microsoft Employee

Hello all,

I have a Form who has two fields namely 'ID' and 'Name'.

The table, which is the datasource of the Form, already has values corresponding to these fields.

In the form when I select the value in ID field, the corresponding Name value should automatically get populated in the Name field.

Will creating an autolookup help ?

Should I write any code ? If yes, where ?

Thanks a lot !!

*This post is locked for comments

  • Martin Dráb Profile Picture
    Martin Dráb 230,214 Most Valuable Professional on at
    RE: AutoPopulating a field upon entering another field.

    You said that "the table, which is the datasource of the Form, already has values corresponding to these fields". So why would you populate them if they're already there. It seems that you forgot to tell us something.

    I would assume that you have two tables - one used as form DS (T1) and another containing the data (T2). You want select an ID from T2 and copy both ID and name from T2 to T1. Please confirm my assumption. If it's correct, why didn't you said that by yourself? You didn't say even that you have two tables.

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: AutoPopulating a field upon entering another field.

    Hi Raghav,

    I suggest you add the code on the modifiedfield() method on the table.

    Below is a sample:

    public void modifiedField(FieldId _fieldId)

    {

    super(_fieldId);

       switch(_fieldId)

       {

           case fieldNum(MyTable,ID):

           //query to get name

          this.Name = 'ABC';//Load value from query here

          break;

      }

    }

  • Suggested answer
    5400 Profile Picture
    5400 7,160 on at
    RE: AutoPopulating a field upon entering another field.

    It is very simple. you can write code in modify method to populate the name value with respect to ID field.

    Example: \Data Dictionary\Tables\InventTable\Methods\modifiedFieldValue

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans