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)

Auto-populate fields from selected lookup of drop-down list

(0) ShareShare
ReportReport
Posted on by

Hi all,

I'm new to AX and x++, i have this scenario :

I have MyForm table, i have lists of address in a drop-down/ combobox which contains lookup of address's detail, city, state and country (It's from parent table : VendTable. MyForm is it's child). When i select one of address from the list, i want to show the each lookup fields (address's detail, city, state and country) into each fields next to the drop-down/combobox control in grid. Anyone know how to do that? Thanks.

0246.1.PNG 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Johnkrish Profile Picture
    781 on at
    RE: ASK : auto-populate fields from selected lookup of drop-down list.

    Hi Anisa,

    yes you can do this by the way of overriding the control modified method. In your case you have to write the logic within the modified method of your drop down control.

    regards,

    Johnkrish

  • Martin Dráb Profile Picture
    236,867 Most Valuable Professional on at
    RE: Auto-populate fields from selected lookup of drop-down list

    What's the datasource of your grid?

  • Verified answer
    UmesH@ Profile Picture
    810 on at
    RE: Auto-populate fields from selected lookup of drop-down list

    Override modified method of that lookup field get values from parent table and fill in grid fields.

    Like

    //DSNC datasource name
    //PPU  datasource field name
    //PU  datasource field name
    public void modified()
    {
        int value;
        super();
         value = str2int(DSNC.PPU) * any2int(DSNC.PU);
         DSNC.UP =value;
    }

    Or

    //Student Table name
         
    Display str StudentName()
    {
            A_Student _Student;
            ;
            select Student_Name from _Student where _Student.Student_ID== this.Mark_Student;
            return _Student.Student_Name;
    }
         
    //fill stringedit by changing dropdown
    //set this method in sub table method node
    
    

    Set StudentName Method Name in Which Grid Field You Want to Fill in Filed DataSourceMethod Property.

  • Community Member Profile Picture
    on at
    RE: Auto-populate fields from selected lookup of drop-down list

    I'll try that John, Thanks.

    Martin : My grid and myForm has it's own datasource, let's say myAddrTable. About thorough details here's a previous post about this form community.dynamics.com/.../472335

  • Martin Dráb Profile Picture
    236,867 Most Valuable Professional on at
    RE: Auto-populate fields from selected lookup of drop-down list

    You shouldn't create your own address tables. AX already has a framework for that: the Global Address Book. You would have to write all the logic again and you would lose the benefits of centralized address storage.

  • Community Member Profile Picture
    on at
    RE: Auto-populate fields from selected lookup of drop-down list

    Okay, Martin i'll read it. Is it really bad to create my own address table whatever the purposes are? But can you be more detail of what should i do then? Thanks.

  • Community Member Profile Picture
    on at
    RE: Auto-populate fields from selected lookup of drop-down list

    Hi Jignesh Patel

    i'll try that, but i think what Martin says might be the best practice so i'm  going to learn both. Thanks.

  • Community Member Profile Picture
    on at
    RE: Auto-populate fields from selected lookup of drop-down list

    Hi Martin,

    I have read Global address book link you gave me. My case here is that "MyForm" showing list of addresses that is having by Vendor X in Vendor Form (Previous case : community.dynamics.com/.../472335 ). Now, these addresses if selected.. will be used for default address in my project that i'm working on which is Tax VAT module. So "MyForm" is only for setup. If i shouldn't create my own address table, which table should i use then? Is it LogisticsPostalAddress? Or should i create an address view? Thanks Martin for the help.

  • Verified answer
    Martin Dráb Profile Picture
    236,867 Most Valuable Professional on at
    RE: Auto-populate fields from selected lookup of drop-down list

    You should link to addresses indirectly through locations (LogisticsLocation). Let me quote the aforementioned white paper:

    In Microsoft Dynamics AX 2012, we introduced the concept of location to refer to both a physical location (postal address) and electronic address (contact information). Postal address and contact information cannot exist without a location. The addition of support for location affects cross-company sharing, and normalization. In addition, support has been added for date-effective postal addresses and contact information.
  • Community Member Profile Picture
    on at
    RE: Auto-populate fields from selected lookup of drop-down list

    It solved now, how i solved it is :

    First, it's just like what Martin has said. I shouldn't create my own address table. So inspired by what Martin has taught me i link my table directly into LogisticsPostalAddress table and other necessary table that i needed.

    Second, to get the value from the selected list in combobox i solved it with Jignes solution. That is using "display()" in my table level, and called this method in DataMethod property in my StringEdit.

    Thanks it worked now.

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#2
AlissonGodoy Profile Picture

AlissonGodoy 2

#2
NNaumenko Profile Picture

NNaumenko 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans