Skip to content

[Event Request] codeunit 444 "Purchase-Post Prepayments" - UpdatePrepmtAmountOnPurchLines procedure #30111

@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 UpdatePrepmtAmountOnPurchLines 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 PurchasePostPrepayments.Codeunit.al object are:

    [IntegrationEvent(false, false)]
    local procedure OnUpdatePrepmtAmountOnPurchLinesOnAfterSetFilters(var PurchLine: Record "Purchase Line"; PurchHeader: Record "Purchase Header"; var NewTotalPrepmtAmount: Decimal)
    begin
    end;

    [IntegrationEvent(false, false)]
    local procedure OnUpdatePrepmtAmountOnPurchLinesOnBeforeErrorIfLinesNotFound(var PurchLine: Record "Purchase Line"; PurchHeader: Record "Purchase Header"; var RaiseError: Boolean)
    begin
    end;

    [IntegrationEvent(false, false)]
    local procedure OnUpdatePrepmtAmountOnPurchLinesOnBeforeModify(var PurchLine: Record "Purchase Line"; PurchHeader: Record "Purchase Header"; var NewTotalPrepmtAmount: Decimal; var TotalPrepmtAmount: Decimal)
    begin
    end;

Event 1: OnUpdatePrepmtAmountOnPurchLinesOnAfterSetFilters 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: OnUpdatePrepmtAmountOnPurchLinesOnBeforeErrorIfLinesNotFound should be added after attempting to retrieve prepayment purchase 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: OnUpdatePrepmtAmountOnPurchLinesOnBeforeModify 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