-
Notifications
You must be signed in to change notification settings - Fork 317
E-Document - Add link action. #6175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…te/magnushar/LinkToExisting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds functionality to link e-documents to existing purchase documents instead of always creating new ones. It introduces a "Link to existing document" action on the draft page and tracks whether documents were created from e-documents or linked to existing ones, preventing deletion of manually created documents.
Changes:
- Added "Link to existing document" action to the E-Document Purchase Draft page with filtering by vendor and amount
- Introduced "Created from E-Document" field to track document origin and conditionally delete only auto-created documents
- Extended E-Doc. Import Parameters with "Existing Doc. RecordId" field to support linking workflow
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| EDocumentPurchaseDraft.Page.al | Added LinkToExistingDocument action and DoLinkToExistingDocument procedure to enable manual linking |
| EDocCreatePurchaseInvoice.Codeunit.al | Modified ApplyDraftToBC to support linking to existing documents; updated RevertDraftActions to preserve manually created documents |
| EDocImportParameters.Table.al | Added "Existing Doc. RecordId" field to pass selected document through processing pipeline |
| EDocumentProcessing.Codeunit.al | Added helper procedures: GetPurchaseDocTypeFilter, LinkToExistingPurchaseDocument, ErrorIfNotAllowedToLinkToExistingDoc, and OpenPurchaseDocumentList |
| EDocPurchaseHeader.TableExt.al | Added "Created from E-Document" boolean field with proper copyright header |
| EDocLinkToExistingTest.Codeunit.al | Comprehensive test coverage for linking functionality including validation, document selection, and post-link behavior scenarios |
| EDocProcessTest.Codeunit.al | Added test for GetPurchaseDocTypeFilter function |
| LibraryEDocument.Codeunit.al | Enhanced CreateInboundEDocument to set Direction and Service fields for proper test setup |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...pps/W1/EDocument/App/src/Processing/Import/FinishDraft/EDocCreatePurchaseInvoice.Codeunit.al
Show resolved
Hide resolved
src/Apps/W1/EDocument/App/src/Processing/Import/Purchase/EDocumentPurchaseDraft.Page.al
Show resolved
Hide resolved
src/Apps/W1/EDocument/App/src/Processing/Import/Purchase/EDocumentPurchaseDraft.Page.al
Show resolved
Hide resolved
src/Apps/W1/EDocument/App/src/Processing/Import/Purchase/EDocumentPurchaseDraft.Page.al
Show resolved
Hide resolved
src/Apps/W1/EDocument/App/src/Processing/EDocumentProcessing.Codeunit.al
Outdated
Show resolved
Hide resolved
src/Apps/W1/EDocument/App/src/Processing/EDocumentProcessing.Codeunit.al
Outdated
Show resolved
Hide resolved
…odeunit.al Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Summary
Overview
The Link to Existing Document action allows users to associate an incoming e-document with a purchase document that already exists in Business Central, rather than creating a new document. This is useful when:
Prerequisites
Before you can use the Link to Existing Document action:
How to link an e-document to an existing document
What happens after linking
When you link an e-document to an existing purchase document:
Field | Value -- | -- E-Document Link (on Purchase Document) | Set to the e-document's system ID Doc. Amount Incl. VAT | Transferred from e-document total Doc. Amount VAT | Transferred from e-document VAT total Created from E-Document | Set to No (the document existed before linking) E-Document Status | Changed to ProcessedImportant: No new purchase document is created when linking to an existing document.
Relinking to a different document
If the e-document is already processed (linked to a document) and you want to link it to a different document:
When you select Link to Existing Document, a warning message appears:
If you proceed:
The newly selected document becomes linked to the e-document
Work Item(s)
Fixes AB#608917