web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Calculate subtotal

(0) ShareShare
ReportReport
Posted on by 487

Hi,

When I change the quantity by code in a salesline, it does not recalculate the totals and subtotals. Even tough I do a validate quantity.

When i change line, it does. Any idea how I can force the sub and total calulcations in my onvalidate please?

Cheers

I have the same question (0)
  • Avinash B Profile Picture
    1,455 on at

    Hi

    There is a function called UpdateAmounts() in the Sales Line table. Did you try by calling this function?

    Cheers

    Avinash B

  • Hedi Daneels Profile Picture
    487 on at

    Sadly, it doesnt change anything.

  • Suggested answer
    Avinash B Profile Picture
    1,455 on at

    Hi

    Which fields you want to update? Are they standard fields or customised fields?

    Can you provide some more information.

    Cheers

    Avinash B

  • Hedi Daneels Profile Picture
    487 on at

    I have a custom field, lets call it "amount".  The quantity field is hidden.

    In my "onvalidate" of the amount field, i do:

    quantity:=amount;

    validate(quantity);

    this validates my line correctly, but, only when i leave the line (for example, by pressing the down key), will it update the sub totals and totals

    Cheers

  • Verified answer
    Avinash B Profile Picture
    1,455 on at

    Hi 

    actually validate trigger is called when you enter the data into the field. In your case when you enter the amount and tab out the validate should be called.

     Try this code on onvalidate of your amount field

    validate(quantity, amount);

     UpdateAmounts()

     cheers

  • Hedi Daneels Profile Picture
    487 on at

    Thank you!

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,229

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,867 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,153 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans