ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] Codeunit 130512 "Library - Purchase" - OnAfterCreatePurchHeader

Open aobsgit opened this issue 5 years ago • 1 comments

Hi Could you please add an event in procedure "CreatePurchHeader"

  procedure CreatePurchHeader(var PurchaseHeader: Record "Purchase Header"; DocumentType: Enum "Purchase DocumentType"; BuyfromVendorNo: Code[20])
  begin
    DisableWarningOnCloseUnpostedDoc;
    DisableWarningOnCloseUnreleasedDoc;
    DisableConfirmOnPostingDoc;
    Clear(PurchaseHeader);
    PurchaseHeader.Validate("Document Type", DocumentType);
    PurchaseHeader.Insert(true);
    if BuyfromVendorNo = '' then
        BuyfromVendorNo := CreateVendorNo;
    PurchaseHeader.Validate("Buy-from Vendor No.", BuyfromVendorNo);
    if PurchaseHeader."Document Type" in [PurchaseHeader."Document Type"::"Credit Memo",
                                          PurchaseHeader."Document Type"::"Return Order"]
    then
        PurchaseHeader.Validate("Vendor Cr. Memo No.", LibraryUtility.GenerateGUID)
    else
        PurchaseHeader.Validate("Vendor Invoice No.", LibraryUtility.GenerateGUID);
    SetCorrDocNoPurchase(PurchaseHeader);
    PurchaseHeader.Modify(true);

   ---NEW CODE START 
   OnAfterCreatePurchHeader(PurchaseHeader, DocumentType.AsInteger(), BuyfromVendorNo);
   ---NEW CODE END
end;

<<<

[IntegrationEvent(false, false)]
local procedure OnAfterCreatePurchHeader(var PurchaseHeader: Record "Purchase Header"; Enum "Purchase DocumentType"; BuyfromVendorNo: Code[20])
begin
end;

aobsgit avatar Dec 15 '20 11:12 aobsgit

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 22 '20 12:12 JesperSchulz