Why do you need this change?
In 4PS Construct, we require additional processing after an electronic document is sent. To implement our custom logic, we need access to the Electronic Document Format (Rec), the generated file name, the document variant, and the electronic format code after the electronic sending process is completed.
Describe the request
Dear ALAppExtensions team,
On behalf of 4PS, I would like to request the integration event OnAfterSendElectronically to be available at the end of the SendElectronically procedure of table 61 "Electronic Document Format".
procedure SendElectronically(var TempBlob: Codeunit "Temp Blob"; var ClientFileName: Text[250]; DocumentVariant: Variant; ElectronicFormat: Code[20])
var
RecordExportBuffer: Record "Record Export Buffer";
TempErrorMessage: Record "Error Message" temporary;
ErrorMessage: Record "Error Message";
EntryTempBlob: Codeunit "Temp Blob";
RecRef: RecordRef;
EntryFileInStream: InStream;
ZipFileOutStream: OutStream;
DocumentUsage: Enum "Electronic Document Format Usage";
StartID: Integer;
EndID: Integer;
IsMissingFileContent: Boolean;
begin
GetDocumentFormatUsage(DocumentUsage, DocumentVariant);
if not Get(ElectronicFormat, DocumentUsage) then begin
Usage := DocumentUsage;
Error(NonExistingDocumentFormatErr, ElectronicFormat, Format(Usage));
end;
RecRef.GetTable(DocumentVariant);
OnSendElectronicallyOnAfterRecRefGetTable(Rec, RecRef);
StartID := 0;
RecordExportBuffer.LockTable();
if RecRef.FindSet() then
repeat
Clear(RecordExportBuffer);
RecordExportBuffer.RecordID := RecRef.RecordId;
RecordExportBuffer.ClientFileName :=
GetAttachmentFileName(RecRef, GetDocumentNo(RecRef), GetDocumentType(RecRef), 'xml');
RecordExportBuffer.ZipFileName :=
GetAttachmentFileName(RecRef, GetDocumentNo(RecRef), GetDocumentType(RecRef), 'zip');
OnSendElectronicallyOnBeforeRecordExportBufferInsert(RecordExportBuffer, RecRef);
RecordExportBuffer.Insert(true);
if StartID = 0 then
StartID := RecordExportBuffer.ID;
EndID := RecordExportBuffer.ID;
until RecRef.Next() = 0;
RecordExportBuffer.SetRange(ID, StartID, EndID);
if RecordExportBuffer.FindSet() then
repeat
ErrorMessage.SetContext(RecordExportBuffer);
ErrorMessage.ClearLog();
CODEUNIT.Run("Codeunit ID", RecordExportBuffer);
TempErrorMessage.CopyFromContext(RecordExportBuffer);
ErrorMessage.ClearLog(); // Clean up
if not RecordExportBuffer."File Content".HasValue() then
IsMissingFileContent := true;
until RecordExportBuffer.Next() = 0;
// Display errors in case anything went wrong.
TempErrorMessage.ShowErrorMessages(true);
if IsMissingFileContent then
Error(ElectronicDocumentNotCreatedErr);
if RecordExportBuffer.Count > 1 then begin
TempBlob.CreateOutStream(ZipFileOutStream);
DataCompression.CreateZipArchive();
ClientFileName := CopyStr(RecordExportBuffer.ZipFileName, 1, 250);
RecordExportBuffer.FindSet();
repeat
RecordExportBuffer.GetFileContent(EntryTempBlob);
EntryTempBlob.CreateInStream(EntryFileInStream);
DataCompression.AddEntry(EntryFileInStream, RecordExportBuffer.ClientFileName);
until RecordExportBuffer.Next() = 0;
DataCompression.SaveZipArchive(ZipFileOutStream);
DataCompression.CloseZipArchive();
end else
if RecordExportBuffer.FindFirst() then begin
RecordExportBuffer.GetFileContent(TempBlob);
ClientFileName := RecordExportBuffer.ClientFileName;
end;
OnSendElectronicallyOnBeforeDeleteAll(RecordExportBuffer, ClientFileName, DocumentVariant);
RecordExportBuffer.DeleteAll();
OnAfterSendElectronically(Rec, ClientFileName, DocumentVariant, ElectronicFormat); //new
end;
Integration Event:

Internal work item: [AB#630961](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/630961)
Why do you need this change?
In 4PS Construct, we require additional processing after an electronic document is sent. To implement our custom logic, we need access to the Electronic Document Format (Rec), the generated file name, the document variant, and the electronic format code after the electronic sending process is completed.
Describe the request
Dear ALAppExtensions team,
On behalf of 4PS, I would like to request the integration event OnAfterSendElectronically to be available at the end of the SendElectronically procedure of table 61 "Electronic Document Format".
Integration Event: