ALAppExtensions
ALAppExtensions copied to clipboard
[Event Request] CU 79 "Sales-Post and Send" OnAfterConfirmBeforePostAndSend
Can you add an OnBeforeConfirmPostAndSend to the function "Code" in Codeunit 79 "Sales-Post and Send", with a "DocumentPosted" variable to allow us to bypass standard functionality?
Example below:
local procedure "Code"()
var
TempDocumentSendingProfile: Record "Document Sending Profile" temporary;
SalesPost: Codeunit "Sales-Post";
D365A1ASalesPost: Codeunit "D365A1A Sales-Post";
SalesPostYesNo: Codeunit "Sales-Post (Yes/No)";
SalesPostYesNoSubcr: codeunit "D365A1A Sales Post-Send Sub.";
HideDialog: Boolean;
begin
HideDialog := false;
OnBeforePostAndSend(SalesHeader, HideDialog, TempDocumentSendingProfile);
if not HideDialog then
with SalesHeader do
case "Document Type" of
"Document Type"::Invoice,
"Document Type"::"Credit Memo",
"Document Type"::Order:
if not ConfirmPostAndSend(SalesHeader, TempDocumentSendingProfile) then
exit;
else
Error(NotSupportedDocumentTypeErr, "Document Type");
end;
TempDocumentSendingProfile.CheckElectronicSendingEnabled;
ValidateElectronicFormats(TempDocumentSendingProfile);
//<< NEW
OnAfterConfirmBeforePostAndSend(SalesHeader,HideDialog,TempDocumentSendingProfile,DocumentPosted);
if not DocumentPosted then begin
//>> NEW
if SalesHeader."Document Type" = SalesHeader."Document Type"::Order then begin
SalesPostYesNo.PostAndSend(SalesHeader);
if not (SalesHeader.Ship or SalesHeader.Invoice) then
exit;
end else
CODEUNIT.Run(CODEUNIT::"Sales-Post", SalesHeader);
//<< NEW
end;
//>> NEW
OnAfterPostAndBeforeSend(SalesHeader);
Commit;
D365A1ASalesPost.SendPostedDocumentRecord(SalesHeader, TempDocumentSendingProfile);
OnAfterPostAndSend(SalesHeader);
end;
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. 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.