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...
Unanswered

Bug in my code, calculate totals in sales documents.

(0) ShareShare
ReportReport
Posted on by 487

Hello Everyone,

Sadly, I am back again with my bug in totals on sales documents.

I have a couple of automated lines where the quantity is automatically modified when input (like quantity) is changed on other lines. Simply put, those are handling fees that change based on the sales lines content.

A very helpful user here, suggested to validate my Quantities, which helped, slightly.

My problem is, my total excl vat is now correct, but my subtotal excl vat is not. Even when validating the quantities just after modifying those fee lines.

For some unknown reason, when the system calculates my sub total, it does not count those automated fee lines. It does count them when calculating the totals excl vat.

Any idea's of where I should be looking? Or ways to force those sub totals?

To give you an idea of code structure:

Sales line extension

- on modify : code that do some calculations on the current line and changes the quantity of the current line. at the end, i do a validate on the quantities to force recalculation

- on after modify, code that adds up all the existing lines (except fee lines) and take the total quantities and put them in the fee lines. at the end, i do a validate on the quantities to force recalculation

I hope you guys can help

Cheers

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

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 674 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 362 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 359 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans