Skip to content
This repository was archived by the owner on Oct 19, 2026. It is now read-only.
This repository was archived by the owner on Oct 19, 2026. It is now read-only.

[Event Request] codeunit 444 "Purchase-Post Prepayments" - OnBeforePrepmtAmount #30434

Closed

Description

Why do you need this change?

We would like to request a new integration event on before of the PrepmtAmount procedure in codeunit 444 "Purchase-Post Prepayments". The equivalent event already exists in the "Sales-Post Prepayments" codeunit but it is not available for purchase scenario.

Describe the request

We would like to request the new event here, on before of the PrepmtAmount function:

Image

New integration code:

    [IntegrationEvent(false, false)]
    local procedure OnBeforePrepmtAmount(var PurchaseLine: Record "Purchase Line"; DocumentType: Option Invoice,"Credit Memo",Statistic; var Result: Decimal; var IsHandled: Boolean)
    begin
    end;

Internal work item: AB#647921

Activity

  1. added
    missing-infoThe issue misses information that prevents it from completion.
    on Aug 25, 2026
  2. github-actions commented on Aug 25, 2026

    @github-actions
    Contributor

    Hi Tuan Nguyen (@tuan-nguyen-fenwick),

    Thank you for your extensibility request. To help us process it efficiently, please update the issue to include the required information.

    📚 Extensibility Guidelines

    Missing Information:

    • Existing extensibility options reviewed: Which existing events or extensibility patterns were evaluated, and why they are insufficient.
    • Why an IsHandled event is required: A specific justification for why an IsHandled event is necessary here instead of a regular event, including what standard logic must be bypassed or replaced and why.
    • Performance note: A brief note describing expected execution frequency and impact.
    • Data sensitivity/security note: A brief confirmation of whether any sensitive data is exposed.
    • Multi-extension interaction/conflict risk: A brief note about potential conflict risk if multiple subscribers handle the event.

    Please update the issue with the missing details. We'll automatically re-analyze once updated.

    Note

    Automatically generated by the Triage Agent — advisory only. An engineer will review before any action is taken.

    Tip

    Not accurate? Reply with /not-accurate (optional: add a short explanation). Your feedback improves future responses.

  3. tuan-nguyen-fenwick commented on Aug 27, 2026

    @tuan-nguyen-fenwick
    ContributorAuthor
    • Existing extensibility options reviewed: There's no alternative option to overwrite prepayment amount. Sales-side also has it so it would be nice to allow extensibility for purchasing.
    • Why an IsHandled event is required: IsHandled is needed so it doesn't return the standard calculation within the function.
    • Performance note: Should be minimal, we intend to use it with a manual-binding subscriber.
    • Data sensitivity/security note: No, no sensitive data is needed or retrieved from the intended subscriber.
    • Multi-extension interaction/conflict risk: Should be minimal. Enough variables are being passed through to confirm and resolve if conflict occurs.
  4. added
    SCMGitHub request for SCM area
    event-requestRequest for adding an event
    and removed
    missing-infoThe issue misses information that prevents it from completion.
    on Aug 27, 2026
  5. github-actions commented on Aug 27, 2026

    @github-actions
    Contributor

    ✅ Analysis complete - ready for further processing


    Implementation:

    Add a new integration event at the start of the PrepmtAmount procedure in Codeunit 444 Purchase-Post Prepayments so extensions can override the returned prepayment amount.

    Location in PrepmtAmount() procedure:

    procedure PrepmtAmount(PurchLine: Record "Purchase Line"; DocumentType: Option Invoice,"Credit Memo",Statistic): Decimal
    var
        Result: Decimal;
        IsHandled: Boolean;
    begin
        IsHandled := false;
        OnBeforePrepmtAmount(PurchLine, DocumentType, Result, IsHandled);
        if IsHandled then
            exit(Result);
    
        case DocumentType of
            DocumentType::Statistic:
                exit(PurchLine."Prepmt. Line Amount");
            DocumentType::Invoice:
                exit(PurchLine."Prepmt. Line Amount" - PurchLine."Prepmt. Amt. Inv.");
            else
                exit(PurchLine."Prepmt. Amt. Inv." - PurchLine."Prepmt Amt Deducted");
        end;
    end;

    Event Publisher (add at the end of the codeunit with other events):

    [IntegrationEvent(false, false)]
    local procedure OnBeforePrepmtAmount(var PurchaseLine: Record "Purchase Line"; DocumentType: Option Invoice,"Credit Memo",Statistic; var Result: Decimal; var IsHandled: Boolean)
    begin
    end;

    File: PurchasePostPrepayments.Codeunit.al

    Note

    Automatically generated by the Triage Agent — advisory only. An engineer will review before any action is taken.

    Tip

    Not accurate? Reply with /not-accurate (optional: add a short explanation). Your feedback improves future responses.

  6. JesperSchulz commented on Sep 18, 2026

    @JesperSchulz
    Contributor

    The requested change has been implemented and merged in microsoft/BCApps#10898. The corresponding Azure Boards item 647921 remains in New, so the automatic GitHub closure did not run. Closing this issue as completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    SCMGitHub request for SCM areaevent-requestRequest for adding an eventext-ready-to-implementReviewed and ready to implement and create PR

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions