Skip to content

[Event Request] codeunit 442 "Sales-Post Prepayments" - UpdatePrepmtAmountOnSaleslines procedure #30110

@tuan-nguyen-fenwick

Description

@tuan-nguyen-fenwick

Why do you need this change?

We would like to request the addition of 3 new integration events to further enhance the extensibility of the UpdatePrepmtAmountOnSalesLines procedure in Base Application.

The existing implementation does not provide sufficient extension points to control key parts of the prepayment update process. Specifically, we are not able to:

  • Adjust or override the filters applied when retrieving prepayment sales lines.
  • Handle scenarios where no prepayment lines exist without triggering an error.
  • Run custom logic before individual sales lines are updated.

Describe the request

The 3 new proposed events that we would like to add at the end of the SalesPostPrepayments.Codeunit.al object are:

    [IntegrationEvent(false, false)]
    local procedure OnUpdatePrepmtAmountOnSalesLinesOnAfterSetFilters(var SalesLine: Record "Sales Line"; SalesHeader: Record "Sales Header"; var NewTotalPrepmtAmount: Decimal)
    begin
    end;

    [IntegrationEvent(false, false)]
    local procedure OnUpdatePrepmtAmountOnSalesLinesOnBeforeErrorIfLinesNotFound(var SalesLine: Record "Sales Line"; SalesHeader: Record "Sales Header"; var RaiseError: Boolean)
    begin
    end;

    [IntegrationEvent(false, false)]
    local procedure OnUpdatePrepmtAmountOnSalesLinesOnBeforeModify(var SalesLine: Record "Sales Line"; SalesHeader: Record "Sales Header"; var NewTotalPrepmtAmount: Decimal; var TotalPrepmtAmount: Decimal)
    begin
    end;

Event 1: OnUpdatePrepmtAmountOnSalesLinesOnAfterSetFilters should be added after filters are set and right before the table is locked. This allows extensions to adjust filters prior to processing and provides a safe hook before record locking occurs.

Event 2: OnUpdatePrepmtAmountOnSalesLinesOnBeforeErrorIfLinesNotFound should be added after attempting to retrieve prepayment sales lines, when no lines are found. This enables subscribers to suppress the standard error. Introduces a RaiseError variable and the default behaviour remains unchanged by setting it to RaiseError = true

Event 3: OnUpdatePrepmtAmountOnSalesLinesOnBeforeModify should be immediately before each line record is modified. This allows extensions to adjust values prior to modification.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    missing-infoThe issue misses information that prevents it from completion.

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions