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

Announcements

No record found.

News and Announcements icon
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

  • 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 554 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 360 Super User 2026 Season 2

#3
Teagen Boll Profile Picture

Teagen Boll 201 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans