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

Salesdocument: use parameter to calculate quantity

(0) ShareShare
ReportReport
Posted on by 487

Hello Everyone,

I am trying to do something a bit complicated in my sales document, and having a lot of trouble making it work.

To know my quantity, the user inputs a number in a custom field (lets call it "amount"). I have an onModify code block that will take that amount, do some stuff with it, and take the resulting value and assign it to quantity. A decimal number.

Now, I started by having the user input the value in the quantity field, and put the real amount in the custom field, and multiply it with my unit price. This had the following issues:

- cannot calculate totals for the document

- issues with discounts

- plenty other issues i encountered

I tried another approach, the one cited before. I have the user fill in a custom field called amount, and put the correct decimal in quantity. But this also gives a lot of issues for BC.

- line amounts are not always being calculated

- document totals are not being calculated, or only sometimes

- other inconsistencies

The thing is, I also have automated lines where the amounts are calculated automatically (sum of other lines, etc).

I really feel like this is not the right approach for my quantities, and as long as those are not right, I will be stuck with my other "parts", like the automatically calculated lines, etc.

Can you guys give some input/ideas please?

Cheers

I have the same question (0)

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,857 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,047 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 959 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans