Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[IT][Event Request][Codeunit][12173] "Vendor Bill List - Post" - Function PostVendorBillLine() & Function PostBalanceAccount()

Open Beginner friendly
#12,422 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
66/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Domain
backend

Research direction

Open Codeunit 12173 "Vendor Bill List - Post" and locate the procedures PostVendorBillLine() and PostBalanceAccount(). Add the two [IntegrationEvent(false, false)] declarations exactly as given in the issue, introduce the IsHandled variable, and wrap the Gen. Journal Line initialization block in if not IsHandled then begin ... end; while keeping the existing OnBefore* events and GenJnlPostLine.RunWithCheck calls outside the guard. Done when the AL package compiles and the new events are callable from an extension; note this is a Microsoft-owned repo where extensibility requests are triaged, so confirm maintainers accept the change before investing.

Written by the indexing model from the issue text.

Description

missing-info Team: Finance
Why do you need this change?

Hello,
We would need new events in the "PostVendorBillLine" and "PostBalanceAccount" procedures of Codeunit 12173 "Vendor Bill List - Post", in order to manage custom fields.

New Events and Code:

    procedure PostVendorBillLine(var GenJnlLine: Record "Gen. Journal Line"; VendorBillHeader: Record "Vendor Bill Header"; VendorBillLine: Record "Vendor Bill Line"; VendLedgEntry: Record "Vendor Ledger Entry"; Bill: Record Bill; var AmountLCY: Decimal)
    var
        Tax: Option " ",Withhold,"Free Lance",Company;
       //New Variable
        IsHandled: Boolean;
    begin
        GenJnlLine.Init();
//New Code
        IsHandled:=False; 
OnAfterInitGenJnlLineOnPostVendorBillLine(GenJnlLine,VendorBillHeader,VendorBillLine,VendLedgEntry,Bill,AmountLCY,IsHandled);
       if not IsHandled then begin
//
        GenJnlLine.Validate("Posting Date", VendorBillHeader."Posting Date");
        GenJnlLine."Document Type" := GenJnlLine."Document Type"::Payment;
        GenJnlLine."Document No." := VendorBillHeader."Vendor Bill List No.";
        GenJnlLine."Document Date" := VendorBillHeader."List Date";
        GenJnlLine."Account Type" := GenJnlLine."Account Type"::Vendor;
        GenJnlLine.Validate("Account No.", VendorBillLine."Vendor No.");
        GenJnlLine."Due Date" := VendorBillLine."Due Date";
        GenJnlLine."External Document No." := VendorBillLine."Vendor Bill List No.";
        GenJnlLine.Validate(Amount, VendorBillLine."Amount to Pay");
        GenJnlLine.Validate("Currency Code", VendorBillHeader."Currency Code");
        if not VendorBillLine."Manual Line" then begin
            GenJnlLine.Validate("Salespers./Purch. Code", VendLedgEntry."Purchaser Code");
            ApplyInvAndUpdateLedgEntry(GenJnlLine, VendorBillLine, Tax::" ");
        end else
            GenJnlLine."Applies-to Occurrence No." := VendorBillLine."Document Occurrence";
        GenJnlLine.Description := Bill.Description;
        GenJnlLine."Source Code" := Bill."Vend. Bill Source Code";
        GenJnlLine."System-Created Entry" := true;
        GenJnlLine."Reason Code" := VendorBillHeader."Reason Code";
        GenJnlLine."Shortcut Dimension 1 Code" := VendLedgEntry."Global Dimension 1 Code";
        GenJnlLine."Shortcut Dimension 2 Code" := VendLedgEntry."Global Dimension 2 Code";
        if not VendorBillLine."Manual Line" then
            GenJnlLine."Dimension Set ID" := VendLedgEntry."Dimension Set ID"
        else
            GenJnlLine."Dimension Set ID" := VendorBillLine."Dimension Set ID";
        GenJnlLine."Payment Method Code" := VendorBillHeader."Payment Method Code";
        AmountLCY := GenJnlLine."Amount (LCY)";
//New Code      
 end;
//
        OnBeforePostVendorBillLine(GenJnlLine, VendorBillHeader, VendorBillLine, VendLedgEntry);
        GenJnlPostLine.RunWithCheck(GenJnlLine);
    end;

    procedure PostBalanceAccount(GenJnlLine: Record "Gen. Journal Line"; VendorBillHeader: Record "Vendor Bill Header"; VendorBillLine: Record "Vendor Bill Line"; VendLedgEntry: Record "Vendor Ledger Entry"; Bill: Record Bill)
var
IsHandled:Boolean;    
begin
        GenJnlLine.Init();
//New Code
        IsHandled:=False; OnAfterInitGenJnlLineOnPostBalanceAccount(GenJnlLine,VendorBillHeader,VendorBillLine,VendLedgEntry,Bill,IsHandled);
if not IsHandled then begin
//
        GenJnlLine.Validate("Posting Date", VendorBillHeader."Posting Date");
        GenJnlLine."Document Type" := GenJnlLine."Document Type"::Payment;
        GenJnlLine."Document No." := VendorBillHeader."Vendor Bill List No.";
        GenJnlLine."Document Date" := VendorBillHeader."List Date";
        GenJnlLine."Account Type" := GenJnlLine."Account Type"::"Bank Account";
        GenJnlLine.Validate("Account No.", VendorBillHeader."Bank Account No.");
        GenJnlLine."Currency Code" := VendorBillHeader."Currency Code";
        GenJnlLine.Validate(Amount, -BalanceAmount);
        GenJnlLine.Validate("Amount (LCY)", -BalanceAmountLCY);
        GenJnlLine.Description := Bill.Description;
        GenJnlLine."Source Code" := Bill."Vend. Bill Source Code";
        GenJnlLine."System-Created Entry" := true;
        GenJnlLine."Reason Code" := VendorBillHeader."Reason Code";
        if not VendorBillLine."Manual Line" then
            GenJnlLine.Validate("Salespers./Purch. Code", VendLedgEntry."Purchaser Code");

        GenJnlLine."Shortcut Dimension 1 Code" := VendLedgEntry."Global Dimension 1 Code";
        GenJnlLine."Shortcut Dimension 2 Code" := VendLedgEntry."Global Dimension 2 Code";
        if not VendorBillLine."Manual Line" then
            GenJnlLine."Dimension Set ID" := VendLedgEntry."Dimension Set ID"
        else
            GenJnlLine."Dimension Set ID" := VendorBillLine."Dimension Set ID";
//New Code
end;
//
        GenJnlLine.CreateDimFromDefaultDim(GenJnlLine.FieldNo("Account No."));
        OnBeforePostBalanceAccount(GenJnlLine, VendorBillHeader, VendorBillLine, VendLedgEntry);
        GenJnlPostLine.RunWithCheck(GenJnlLine);
    end;

Signature:

 [IntegrationEvent(false, false)]
  OnAfterInitGenJnlLineOnPostVendorBillLine(var GenJnlLine: Record "Gen. Journal Line"; VendorBillHeader: Record "Vendor Bill Header"; VendorBillLine: Record "Vendor Bill Line"; VendLedgEntry: Record "Vendor Ledger Entry"; Bill: Record Bill; var AmountLCY: Decimal;var IsHandled:Boolean)
  begin
  end;
 [IntegrationEvent(false, false)]
  OnAfterInitGenJnlLineOnPostBalanceAccount(GenJnlLine: Record "Gen. Journal Line"; VendorBillHeader: Record "Vendor Bill Header"; VendorBillLine: Record "Vendor Bill Line"; VendLedgEntry: Record "Vendor Ledger Entry"; Bill: Record Bill;var IsHandled:Boolean)
  begin
  end;

Thank You,
Luca

Describe the request

We need this events to be able to manage custom fields on the Line Insert procedures, and we need to manage the validate triggers of the fields.
This request is a follow-up to an issue opened about a year ago. The requested change has not yet been implemented in the Business Central Base Application.

For reference, please see the previous discussion: https://github.com/microsoft/ALAppExtensions/issues/29093#issuecomment-3883244614

Provide an implementation (optional)
  • I will provide the implementation for this extensibility request
Dominant language
AL
Stars
697
Forks
473
Avg merge
2d 19h
Merged PRs (30d)
493

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/BCApps

All issues in microsoft/BCApps

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.