ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

Codeunit 12 - Gen. Jnl.-Post Line - expose CreateGLEntryBalAcc function

Open Wiechardt opened this issue 6 years ago • 1 comments

Hi Microsoft,

Please can I ask you to change the scope of this function from local to global to allow me to access this function from an extension.

The use case is as follows:

I am busy building an extension to cater for Withholding Tax which can be used in BC 16.3 W1 and GB versions, similar to the localization that was built into the AU version of Business Central.

When applying or un-applying a Customer or Vendor Ledger entry with a related WTH Tax entry, an additional posting should be triggered to either post (or reverse a previous posting) of a Bank Ledger Entry.

I am looking to subscribe to the OnAfterPostCust event in Codeunit 12 (once the Signature has been changed to allow me to access the sender methods), and from this subscription, call the CreateGLEntryBalAcc method to reverse the G/L Entry with a Balancing Entry posting to the Bank Ledger.

In the AU version of Business Central 16.3, the PostCust function has been modified in the following way - the PostCustWHT is called from within the PostCust method, I wish to subscribe to OnAfterPostCust but need access to the sender and I need to be able to post an entry with a Balancing Account as Bank Account.

local procedure PostCust(var GenJnlLine: Record "Gen. Journal Line"; Balancing: Boolean) var ,.... begin .... // Post detailed customer entries DtldLedgEntryInserted := PostDtldCustLedgEntries(GenJnlLine, TempDtldCVLedgEntryBuf, CustPostingGr, true); .... PostCustWHT(GenJnlLine, CustLedgEntry, WHTPostingSetup, WHTAmountLCY); ....

OnAfterPostCust(GenJnlLine, Balancing, TempGLEntryBuf, NextEntryNo, NextTransactionNo);

end;

Many thanks, Wiechardt

Wiechardt avatar Aug 06 '20 07:08 Wiechardt

Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. We will update this issue with information about availability. Please do not reply to this, as we do not monitor closed issues. If you have follow-up questions or requests, please create a new issue where you reference this one.

JesperSchulz avatar Dec 08 '20 11:12 JesperSchulz