Next topic
★ Featured App
Finmatics Autonomous Accounting
Interface for AI-driven document processing tool by Finmatics.
More information
AppSource
Note
NAVAX Dropzones are suitable for upload sizes up to 15000 KB (15 MB).Note
This example serves only to illustrate the simplest implementation. For document attachments, it is recommended to use the NAVAX App NAVAX Drag & Drop Document Attachments. This app is also based on NAVAX Dropzone, but integrates it directly with the document attachment FactBox. For more information, see [Docs] NAVAX Drag & Drop Document Attachments - Generalenumextension 50000 "NVXTEST NCEX Dropzone ID" extends "NCEX Dropzone ID"
{
value(50000; "NVXTEST Customer")
{
Caption = 'NVXTEST Customer', Comment = 'DEU="NVXTEST Debitor"';
}
}
Through this enum extension, the customer will also have the ability to specify the settings and defaults for the new Dropzone later on the NAVAX Dropzone Setup page:
pageextension 50000 "NVXTEST Customer List" extends "Customer List"
{
layout
{
addfirst(factboxes)
{
part(NVXTESTDropzone; "NCEX Dropzone")
{
ApplicationArea = All;
Visible = true;
}
}
}
trigger OnOpenPage()
begin
CurrPage.NVXTESTDropzone.Page.SetDropzoneID("NCEX Dropzone ID"::"NVXTEST Customer");
end;
trigger OnAfterGetCurrRecord()
begin
CurrPage.NVXTESTDropzone.Page.SetCurrRecord(Rec);
end;
}
Note
This block:trigger OnAfterGetCurrRecord()
begin
CurrPage.NVXTESTDropzone.Page.SetCurrRecord(Rec);
end;
can also be omitted if, for example, you need a Dropzone that is not record related. (e.g. import of payment files of the NAVAX App NCPI Payments Import).
Note
An overload with the following additional parameters is also available for the SetDropzoneID function:codeunit 50000 "NVXTEST Event Mgt."
{
[EventSubscriber(ObjectType::Codeunit, Codeunit::"NCEX Dropzone Mgt.", 'OnAfterUpload', '', false, false)]
local procedure NVXTEST_NCEXDropzoneMgt_OnAfterUpload(NCEXDropzoneID: Enum "NCEX Dropzone ID"; CurrRecordVariant: Variant; var UploadedTempBlobList: Codeunit "Temp Blob List"; FileNameList: List of [Text]; AdditionalCallID: Integer)
var
Customer: Record Customer;
DocumentAttachment: Record "Document Attachment";
TempBlob: Codeunit "Temp Blob";
ConfirmManagement: Codeunit "Confirm Management";
RecordRef: RecordRef;
InStream: InStream;
FileName: Text;
i: Integer;
NoOfFiles: Integer;
NoOfNoContentFiles: Integer;
NoRecordSelectedErr: Label 'No %1 is selected.', Comment = 'DEU="Es ist kein %1 ausgewählt."';
UploadMsg: Label 'Do you want to add %1 file(s) to the document attachments of %2 ''%3''?.', Comment = 'DEU="Möchten Sie %1 Datei(en) zu den Beleganhängen von %2 ''%3'' hinzufügen?"';
NoContentFilesMsg: Label 'Files that have no content cannot be added to the document attachments.\\Number of files not added: %1\Number of files added: %2', Comment = 'DEU="Dateien, die keinen Inhalt haben, können nicht zu den Beleganhängen hinzugefügt werden.\\Anzahl nicht hinzugefügter Dateien: %1\Anzahl hinzugefügter Dateien: %2"';
begin
if (NCEXDropzoneID <> NCEXDropzoneID::"NVXTEST Customer") then
exit;
if (UploadedTempBlobList.Count() = 0) then
exit;
if not CurrRecordVariant.IsRecord() then
Error(NoRecordSelectedErr, Customer.TableCaption());
Customer := CurrRecordVariant;
if (Customer."No." = '') then
Error(NoRecordSelectedErr, Customer.TableCaption());
Customer.Get(Customer."No.");
if not ConfirmManagement.GetResponseOrDefault(StrSubstNo(UploadMsg, UploadedTempBlobList.Count(), Customer.TableCaption(), Customer."No."), true) then
exit;
RecordRef.GetTable(Customer);
NoOfFiles := 0;
NoOfNoContentFiles := 0;
for i := 1 to UploadedTempBlobList.Count() do begin
UploadedTempBlobList.Get(i, TempBlob);
if TempBlob.HasValue() then begin
FileNameList.Get(i, FileName);
TempBlob.CreateInStream(InStream);
Clear(DocumentAttachment);
DocumentAttachment.Init();
DocumentAttachment.InitFieldsFromRecRef(RecordRef);
DocumentAttachment.SaveAttachmentFromStream(InStream, RecordRef, FileName);
NoOfFiles += 1;
end else
NoOfNoContentFiles += 1;
end;
if (NoOfNoContentFiles <> 0) then
Message(NoContentFilesMsg, NoOfNoContentFiles, NoOfFiles);
end;
}
Important
if (NCEXDropzoneID <> NCEXDropzoneID::"NVXTEST Customer") then
exit;
This if-condition decides for which Dropzone the code should be executed and must not be omitted under any circumstances.
The value must match the added value from the enumextension.
Finmatics Autonomous Accounting Interface for AI-driven document processing tool by Finmatics. More information AppSource |