Hi, Readers.
Today, I’d like to briefly discuss a requirement I recently navigated in a BC project, how to copy (synchronize) the Incoming Document to all Gen. Journal Lines.
External business documents can come into your company as an email attachment or a paper copy that you scan to file. This scenario is typical of purchases, where such incoming document files represent payment receipts for expenses or small purchases.
On the Incoming Documents page, you can use different functions to review expense receipts, manage OCR tasks, and convert incoming document files, manually or automatically, to the relevant documents or journal lines.

The external files can be attached at any process stage, including to posted documents and to the resulting vendor, customer, and general ledger entries, for example:


More details: Incoming documents
Please note that Incoming documents and Attachments are different functions.


Here’s a small problem: for example, we can add an Incoming Document to each line in General Journals, for example, I added an Incoming Document to the first line.


and then move to the second line, the Incoming Document is empty.

This is standard practice. The user stated that they had already uploaded the file, but when choosing “Select Incoming Document” in the second line, BC did not allow it.


The incoming document has already been assigned to journal batch DEFAULT, line number. 10000.

So, can we upload the file only once and then sync it to other lines? Unfortunately, this cannot be achieved in the standard, it requires customization. The method is actually very simple, you just need to copy the value of Incoming Document Entry No. (165, Integer) to ohter lines.

Let’s see more details.


Done.


Test video:
Of course, these Incoming Documents will also be displayed after the Genral Journals are posted.




Great. Give it a try!!!😁
Source code: Github (Please note that the source code is for reference only, you can improve it according to your own needs)
pageextension 50106 GeneralJournalExt extends "General Journal"
{
actions
{
addafter(IncomingDocAttachFile)
{
action(SyncIncomingDoc)
{
ApplicationArea = All;
Caption = 'Synchronize Incoming Document';
Image = OutlookSyncSubFields;
trigger OnAction()
var
GenJournalLine: Record "Gen. Journal Line";
i: Integer;
begin
if Rec."Incoming Document Entry No." = 0 then begin
Message(IncomingDocumentBlankLbl);
exit
end;
i := 0;
GenJournalLine.Reset();
GenJournalLine.SetRange("Journal Template Name", Rec."Journal Template Name");
GenJournalLine.SetRange("Journal Batch Name", Rec."Journal Batch Name");
GenJournalLine.SetFilter("Incoming Document Entry No.", '<>%1', Rec."Incoming Document Entry No.");
i := GenJournalLine.Count;
if GenJournalLine.FindSet() then begin
GenJournalLine.ModifyAll("Incoming Document Entry No.", Rec."Incoming Document Entry No.");
Message(IncomingDocumentSynchronizedLbl, i);
end;
end;
}
}
addbefore(RemoveIncomingDoc_Promoted)
{
actionref(SyncIncomingDoc_Promoted; SyncIncomingDoc)
{
}
}
}
var
IncomingDocumentSynchronizedLbl: Label 'Incoming Document have been synchronized for %1 Gen. Journal Lines.';
IncomingDocumentBlankLbl: Label 'Please set an Incoming Document for selected Gen. Journal Line.';
}END
Hope this will help.
Thanks for reading.
ZHU




コメント