---
title: "Codeunit 5950 Service-Calc. Discount, extension points 29"
author: "JOP-AL"
url: https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/points/
object: https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/
app: "Base Application"
major: 29
source: https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/
checked: 2026-11-20
changed: 2026-10-05
subject: "Microsoft Dynamics 365 Business Central"
license: "Metadata from Microsoft's symbol packages. AL source MIT, Copyright (c) Microsoft Corporation. Selection and wording © 2026 JOP-AL. https://jonas-paprotka.de/licenses/"
---

# Codeunit 5950 Service-Calc. Discount, extension points 29

JOP-AL, https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/points/

4 procedures and triggers with a step in src/Layers/W1/BaseApp/Service/Document/ServiceCalcDiscount.Codeunit.al, in source order, read from the text, not from a run.

## OnRun

[Line 18](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L18), trigger.

- [26](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L26) calls `CalculateInvoiceDiscount`

## CalculateInvoiceDiscount

[Line 49](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L49), local.

- [58](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L58) raises `OnBeforeCalcServDiscount`, IsHandled
- [66](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L66) raises `OnCalculateInvoiceDiscountOnBeforeIsServiceChargeUpdated`, IsHandled
- [68](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L68) calls `IsServiceChargeUpdated`
- [74](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L74) calls [Table 92 Customer Posting Group](https://jonas-paprotka.de/ref/table/92-customer-posting-group/) `GetServiceChargeAccount`
- [77](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L77) validates [Table 5902 Service Line](https://jonas-paprotka.de/ref/table/5902-service-line/) `Unit Price`
- [78](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L78) writes [Table 5902 Service Line](https://jonas-paprotka.de/ref/table/5902-service-line/) Modify
- [87](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L87) raises `OnCalculateInvoiceDiscountOnAfterSetServiceLineFilters`
- [89](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L89) calls [Table 5902 Service Line](https://jonas-paprotka.de/ref/table/5902-service-line/) `CalcVATAmountLines`
- [91](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L91) calls [Table 290 VAT Amount Line](https://jonas-paprotka.de/ref/table/290-vat-amount-line/) `GetTotalInvDiscBaseAmount`
- [94](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L94) calls [Table 290 VAT Amount Line](https://jonas-paprotka.de/ref/table/290-vat-amount-line/) `GetTotalLineAmount`
- [98](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L98) writes [Table 5900 Service Header](https://jonas-paprotka.de/ref/table/5900-service-header/) Modify
- [107](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L107) calls [Table 19 Cust. Invoice Disc.](https://jonas-paprotka.de/ref/table/19-cust-invoice-disc/) `GetRecord`
- [109](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L109) raises `OnCalculateInvoiceDiscountOnBeforeApplyServiceCharge`
- [113](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L113) calls [Table 4 Currency](https://jonas-paprotka.de/ref/table/4-currency/) `Initialize`
- [115](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L115) calls [Table 5902 Service Line](https://jonas-paprotka.de/ref/table/5902-service-line/) `SetServHeader`
- [119](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L119) validates [Table 5902 Service Line](https://jonas-paprotka.de/ref/table/5902-service-line/) `Unit Price`
- [125](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L125) validates [Table 5902 Service Line](https://jonas-paprotka.de/ref/table/5902-service-line/) `Unit Price`
- [126](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L126) writes [Table 5902 Service Line](https://jonas-paprotka.de/ref/table/5902-service-line/) Modify
- [134](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L134) calls [Table 5902 Service Line](https://jonas-paprotka.de/ref/table/5902-service-line/) `SetServHeader`
- [135](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L135) calls `GetNewServiceLineNoBias`
- [137](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L137) validates [Table 5902 Service Line](https://jonas-paprotka.de/ref/table/5902-service-line/) `No.`
- [137](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L137) calls [Table 92 Customer Posting Group](https://jonas-paprotka.de/ref/table/92-customer-posting-group/) `GetServiceChargeAccount`
- [139](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L139) validates [Table 5902 Service Line](https://jonas-paprotka.de/ref/table/5902-service-line/) `Quantity`
- [140](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L140) raises `OnCalculateInvoiceDiscountOnAfterServiceLine2ValidateQuantity`
- [142](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L142) validates [Table 5902 Service Line](https://jonas-paprotka.de/ref/table/5902-service-line/) `Unit Price`
- [148](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L148) validates [Table 5902 Service Line](https://jonas-paprotka.de/ref/table/5902-service-line/) `Unit Price`
- [150](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L150) raises `OnCalculateInvoiceDiscountOnBeforeServiceLineInsert`
- [151](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L151) writes [Table 5902 Service Line](https://jonas-paprotka.de/ref/table/5902-service-line/) Insert
- [153](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L153) calls [Table 5902 Service Line](https://jonas-paprotka.de/ref/table/5902-service-line/) `CalcVATAmountLines`
- [158](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L158) raises `OnCalculateInvoiceDiscountOnBeforeServiceLine2Delete`, IsHandled
- [160](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L160) writes [Table 5902 Service Line](https://jonas-paprotka.de/ref/table/5902-service-line/) Delete(true)
- [163](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L163) raises `OnCalculateInvoiceDiscountOnAfterApplyServiceCharge`
- [165](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L165) calls `CustInvDiscRecExists`
- [167](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L167) calls [Table 19 Cust. Invoice Disc.](https://jonas-paprotka.de/ref/table/19-cust-invoice-disc/) `GetRecord`
- [169](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L169) calls [Codeunit 65 Discount Notification Mgt.](https://jonas-paprotka.de/ref/codeunit/65-discount-notification-mgt/) `NotifyAboutMissingSetup`
- [176](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L176) writes [Table 5900 Service Header](https://jonas-paprotka.de/ref/table/5900-service-header/) Modify
- [178](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L178) calls [Table 290 VAT Amount Line](https://jonas-paprotka.de/ref/table/290-vat-amount-line/) `SetInvoiceDiscountPercent`
- [183](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L183) calls [Table 5902 Service Line](https://jonas-paprotka.de/ref/table/5902-service-line/) `SetServHeader`
- [184](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L184) calls [Table 5902 Service Line](https://jonas-paprotka.de/ref/table/5902-service-line/) `UpdateVATOnLines`
- [190](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L190) writes [Table 5900 Service Header](https://jonas-paprotka.de/ref/table/5900-service-header/) Modify
- [192](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L192) calls [Table 290 VAT Amount Line](https://jonas-paprotka.de/ref/table/290-vat-amount-line/) `SetInvoiceDiscountPercent`
- [197](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L197) calls [Table 5902 Service Line](https://jonas-paprotka.de/ref/table/5902-service-line/) `SetServHeader`
- [198](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L198) calls [Table 5902 Service Line](https://jonas-paprotka.de/ref/table/5902-service-line/) `UpdateVATOnLines`
- [201](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L201) raises `OnAfterCalcServDiscount`

## CalculateWithServHeader

[Line 212](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L212).

- [216](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L216) calls `CalculateInvoiceDiscount`

## CalculateIncDiscForHeader

[Line 219](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L219).

- [231](https://jonas-paprotka.de/ref/codeunit/5950-service-calc-discount/source/#L231) calls `CalculateInvoiceDiscount`

## Source

AL source 29: https://github.com/microsoft/BCApps, MIT, releases/29.x at 4303e5e584d3aa5d9e98cbc615525a5396ad6ed7.

JOP-AL, 2026-11-20.
