Skip to content

Fix outgoing E-Documents opening Purchase Draft page instead of E-Document card - #9852

Draft
Groenbech96 with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-e-document-link-issue
Draft

Fix outgoing E-Documents opening Purchase Draft page instead of E-Document card#9852
Groenbech96 with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-e-document-link-issue

Conversation

Copilot AI commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Drilling into an outgoing (sales) E-Document from the mixed-direction E-Documents list opened the E-Document Purchase Draft page instead of the E-Document card, since EDocumentHelper.OpenDraftPage only branched on Import Process version, not Direction. Outgoing documents never populate Process Draft Impl., so it kept its default enum value ("Purchase Document"), which resolves to the purchase-draft implementation.

  • EDocumentHelper.Codeunit.al: OpenDraftPage now checks EDocument.Direction = Direction::Outgoing first and opens Page::"E-Document" directly in that case, before evaluating the Import Process version — mirroring the existing pattern used by NewFromFile().
  • Test: Added a regression test that creates an outgoing E-Document on a service with Import Process = Version 2.0 (the scenario that triggered the bug) and asserts OpenDraftPage opens the E-Document card rather than the purchase draft page.
procedure OpenDraftPage(var EDocument: Record "E-Document")
var
    IProcessStructuredData: Interface IProcessStructuredData;
begin
    if EDocument.Direction = EDocument.Direction::Outgoing then begin
        Page.Run(Page::"E-Document", EDocument);
        exit;
    end;

    if EDocument.GetEDocumentService().GetImportProcessVersion() = "E-Document Import Process"::"Version 1.0" then begin
        Page.Run(Page::"E-Document", EDocument);
        exit;
    end;
    IProcessStructuredData := EDocument."Process Draft Impl.";
    IProcessStructuredData.OpenDraftPage(EDocument);
end;

Copilot AI changed the title [WIP] Fix outgoing e-documents opening wrong page Fix outgoing E-Documents opening Purchase Draft page instead of E-Document card Jul 30, 2026
Copilot AI requested a review from Groenbech96 July 30, 2026 11:38
@github-actions github-actions Bot added needs-approval Workflow runs require maintainer approval to start AL: Apps (W1) Add-on apps for W1 labels Jul 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Could not find a linked ADO work item. Please link one by using the pattern 'AB#' followed by the relevant work item number. You may use the 'Fixes' keyword to automatically resolve the work item when the pull request is merged. E.g. 'Fixes AB#1234'

@github-actions github-actions Bot removed the needs-approval Workflow runs require maintainer approval to start label Jul 31, 2026
@Groenbech96

Copy link
Copy Markdown
Contributor

@copilot fix the issues.

Copilot AI commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix the issues.

Fixed in e6559fe. The CI failure was a compile error in the new test (AL0118, missing using Microsoft.eServices.EDocument.Processing.Import; for the E-Document Import Process enum), which was cascading and failing every country-app build.

@github-actions github-actions Bot added needs-approval Workflow runs require maintainer approval to start and removed needs-approval Workflow runs require maintainer approval to start labels Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[E-Document] Outgoing (sales) e-documents open the Purchase Draft page from the E-Documents list

2 participants