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 :
Small and medium business | Business Central, N...
Answered

Auto fill on insert

(0) ShareShare
ReportReport
Posted on by 260

Greetings to all of you!

I will try to explain my question with an example:

Lets say that i want to insert a new line , through AL , in the sales line table.

If i had to do it through the interface like a normal user does, when i fill the quantity with the value 1 , the system will automatically fill the values of the relevant quantity fields.


My problem is that , if i input the line myself through code, and set the quantity of the item line to be equal to 1, the system wll not automatically fill the values of the relevant fields such as outstanding qty, qty to ship,qty to invoice e.t.c.

Due to that , i need to go myself and do it manually which is a little bit annoying.

I bet that there is a smarter way to do it that i just dont know about.

Any thoughts?

Thank you in advance lads!

I have the same question (0)
  • Suggested answer
    Nitin Verma Profile Picture
    21,696 Moderator on at
    RE: Auto fill on insert

    Hi,

    Please use only like this

    Insersaleslines.validate(Quantity,1);

    Insersaleslines.insert(true);

    rest leave on the system

  • Verified answer
    Govinda Kumar Profile Picture
    2,304 Moderator on at
    RE: Auto fill on insert

    Hi, I think you should fill the values using "Validate" method. For example, you can use it like InsertSalesLines.Validate(Quantity, 1); it will execute the onValidate() trigger of that particular field. and will automatically fill in all the relevant fields that depend on the quantity, just as you mentioned you do on the user interface.

    I hope this helps you.

    Regards

  • AntonisK Profile Picture
    260 on at
    RE: Auto fill on insert

    Thank you both!!

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 > Small and medium business | Business Central, NAV, RMS

#1
Sumit Singh Profile Picture

Sumit Singh 2,106

#2
YUN ZHU Profile Picture

YUN ZHU 1,752 Super User 2025 Season 2

#3
OussamaSabbouh Profile Picture

OussamaSabbouh 1,670

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans