From 3de947fed56fc493d679826691d89d8544641b83 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 30 Jan 2026 09:28:34 +0000 Subject: [PATCH 1/4] Initial plan From 1277f3625b0f74d1d0af4294aa0c4cce9598d462 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 30 Jan 2026 09:30:52 +0000 Subject: [PATCH 2/4] Add SaaS check before accessing Agent Task in InboundEDocuments page Co-authored-by: Groenbech96 <17690329+Groenbech96@users.noreply.github.com> --- .../App/src/Document/Inbound/InboundEDocuments.Page.al | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Apps/W1/EDocument/App/src/Document/Inbound/InboundEDocuments.Page.al b/src/Apps/W1/EDocument/App/src/Document/Inbound/InboundEDocuments.Page.al index 2535133301..2ccb171b25 100644 --- a/src/Apps/W1/EDocument/App/src/Document/Inbound/InboundEDocuments.Page.al +++ b/src/Apps/W1/EDocument/App/src/Document/Inbound/InboundEDocuments.Page.al @@ -10,6 +10,7 @@ using Microsoft.Foundation.Attachment; using Microsoft.Purchases.Vendor; using System.Agents; using System.Agents.TaskPane; +using System.Environment; page 6105 "Inbound E-Documents" { @@ -444,7 +445,11 @@ page 6105 "Inbound E-Documents" end; local procedure PopulateTaskInfo() + var + EnvironmentInformation: Codeunit "Environment Information"; begin + if not EnvironmentInformation.IsSaaSInfrastructure() then + exit; AgentTask.SetRange("Company Name", CompanyName()); AgentTask.SetRange("External ID", Format(Rec."Entry No")); if not AgentTask.FindFirst() then From 83c566398c1223318c73b0f48f840c5d8d2450a9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 30 Jan 2026 09:32:13 +0000 Subject: [PATCH 3/4] Clear AgentTask and AgentTaskStatus before SaaS check for clean UI display Co-authored-by: Groenbech96 <17690329+Groenbech96@users.noreply.github.com> --- .../App/src/Document/Inbound/InboundEDocuments.Page.al | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Apps/W1/EDocument/App/src/Document/Inbound/InboundEDocuments.Page.al b/src/Apps/W1/EDocument/App/src/Document/Inbound/InboundEDocuments.Page.al index 2ccb171b25..0f527203a9 100644 --- a/src/Apps/W1/EDocument/App/src/Document/Inbound/InboundEDocuments.Page.al +++ b/src/Apps/W1/EDocument/App/src/Document/Inbound/InboundEDocuments.Page.al @@ -448,13 +448,14 @@ page 6105 "Inbound E-Documents" var EnvironmentInformation: Codeunit "Environment Information"; begin + Clear(AgentTask); + AgentTaskStatus := ''; if not EnvironmentInformation.IsSaaSInfrastructure() then exit; AgentTask.SetRange("Company Name", CompanyName()); AgentTask.SetRange("External ID", Format(Rec."Entry No")); if not AgentTask.FindFirst() then Clear(AgentTask); - AgentTaskStatus := ''; if AgentTask.ID <> 0 then AgentTaskStatus := Format(AgentTask.Status); end; From a8e656bbfafd2517938ca092414ef7757848d702 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 30 Jan 2026 09:36:16 +0000 Subject: [PATCH 4/4] Add ReadPermission check and remove redundant Clear in PopulateTaskInfo Co-authored-by: Groenbech96 <17690329+Groenbech96@users.noreply.github.com> --- .../App/src/Document/Inbound/InboundEDocuments.Page.al | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Apps/W1/EDocument/App/src/Document/Inbound/InboundEDocuments.Page.al b/src/Apps/W1/EDocument/App/src/Document/Inbound/InboundEDocuments.Page.al index 0f527203a9..5fac841168 100644 --- a/src/Apps/W1/EDocument/App/src/Document/Inbound/InboundEDocuments.Page.al +++ b/src/Apps/W1/EDocument/App/src/Document/Inbound/InboundEDocuments.Page.al @@ -452,11 +452,11 @@ page 6105 "Inbound E-Documents" AgentTaskStatus := ''; if not EnvironmentInformation.IsSaaSInfrastructure() then exit; + if not AgentTask.ReadPermission() then + exit; AgentTask.SetRange("Company Name", CompanyName()); AgentTask.SetRange("External ID", Format(Rec."Entry No")); - if not AgentTask.FindFirst() then - Clear(AgentTask); - if AgentTask.ID <> 0 then + if AgentTask.FindFirst() and (AgentTask.ID <> 0) then AgentTaskStatus := Format(AgentTask.Status); end;