Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

Geting Value by default on field In AL Programming

Posted on by 22

How to autofill a value in field from anothor table ??

  • Suggested answer
    Amit Baru Profile Picture
    Amit Baru 3,025 on at
    RE: Geting Value by default on field In AL Programming

    hi,

    pls explain with example. so that we can give you better solution.

    Regards

    Amit

  • Robyn2018 Profile Picture
    Robyn2018 Most Valuable Professional on at
    RE: Geting Value by default on field In AL Programming

    Hi,

    I don't know exactly what do you want to do.  

    If you explain a little we can help you better.

    Roberto

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 73,698 Super User 2024 Season 2 on at
    RE: Geting Value by default on field In AL Programming

    Hi, There is no problem with the code provided by Roberto. You may have added it in the wrong place.

    You can refer to some standard features, for example, on the sales order, when you select a customer, many values from the customer table are automatically populated on the order.

    pastedimage1661301858780v1.png

    Hope this helps.

    Thanks.

    ZHU

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 32,748 Super User 2024 Season 1 on at
    RE: Geting Value by default on field In AL Programming

    In addition to the solution Roberto gave you you can also define a default value for a field in a table.

    docs.microsoft.com/.../devenv-initvalue-property

    And if it is data from another table you want to display. Using a flowdfield of type lookup also might be a good idea.

    docs.microsoft.com/.../flowfields

  • Satyajit Barik Profile Picture
    Satyajit Barik 22 on at
    RE: Geting Value by default on field In AL Programming

    its not working

  • Suggested answer
    Robyn2018 Profile Picture
    Robyn2018 Most Valuable Professional on at
    RE: Geting Value by default on field In AL Programming

    Hi,

    If you want obtain a value from other table (as ie when you introduce a item in a purchase order line and fill in the description and price) you need AL Code, usually in OnValidate Trigger:

    trigger OnValidate()

    var

       ItemRec : record Item;

    begin

      if itemRec.get("No.") then

           description := itemRec.Description;

    end;

    I hope this would be usefull for you.   Best regards,

    Roberto Corella

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: Geting Value by default on field In AL Programming

    what do you mean by autofill? On Open page or from any other trigger?

    Thanks.

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,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans