Skip to main content

Notifications

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 485

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

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 756

#2
YUN ZHU Profile Picture

YUN ZHU 731 Super User 2025 Season 1

#3
Mansi Soni Profile Picture

Mansi Soni 529

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans