From 8527b3c05a67677d7fedb30c3301b2ac355970e4 Mon Sep 17 00:00:00 2001 From: Prangshuman Das Date: Fri, 18 Sep 2026 15:52:03 +0200 Subject: [PATCH] [29.0] Clarify Expense Agent and expense management setup Backport #11541 for AB#650545. Adapt only newly introduced CLEAN30 guards and ObsoleteTag 30.0 properties to CLEAN29 and 29.0; retain release-specific Entra application handling and telemetry ID 0000VGO. (cherry picked from commit 9f382f608fab7e117cfeb1e33fa9f70259386bfa) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7a535d01-fbef-4fb8-b5e9-ad0c29f2921c Copilot-Session: 2c31d71b-4326-483a-9a7e-800a8391563b --- .../src/Integration/EAHttpClient.Codeunit.al | 35 ++-- .../PageExtensions/EAAgentCard.PageExt.al | 4 +- .../src/Setup/Pages/ExpenseAgentSetup.Page.al | 180 ++++++++++++------ .../Pages/ExpenseAgentSetupWizard.Page.al | 80 +++++++- .../Setup/Pages/ExpenseAgentStatus.Page.al | 2 +- 5 files changed, 214 insertions(+), 87 deletions(-) diff --git a/src/Apps/W1/ExpenseAgent/app/src/Integration/EAHttpClient.Codeunit.al b/src/Apps/W1/ExpenseAgent/app/src/Integration/EAHttpClient.Codeunit.al index fd611079291..47c52881691 100644 --- a/src/Apps/W1/ExpenseAgent/app/src/Integration/EAHttpClient.Codeunit.al +++ b/src/Apps/W1/ExpenseAgent/app/src/Integration/EAHttpClient.Codeunit.al @@ -51,6 +51,7 @@ codeunit 6941 "EA Http Client" CanaryAllowlistEndpointTok: Label '/api/v1.0/canary/allowlist', Locked = true; ProdBaseUrlSecretNameTok: Label 'EABaseUrl', Locked = true; CanaryBaseUrlSecretNameTok: Label 'EABaseUrlCanary', Locked = true; + ExpenseAgentSetupMissingTxt: Label 'Expense Agent setup is missing. The service request was not sent.', Locked = true; [NonDebuggable] procedure SubmitExpenseWithAttachments(ConversationId: Text; Context: Text; OnBehalfUser: Text; var TempAttachment: Record "EA Email Attachment" temporary): Boolean @@ -431,14 +432,24 @@ codeunit 6941 "EA Http Client" local procedure GetExpenseAgentBaseUrl(var BaseUrl: SecretText): Boolean var ExpenseAgentSetup: Record "Expense Agent Setup"; + begin + Clear(BaseUrl); + if not ExpenseAgentSetup.Get() then begin + FeatureTelemetry.LogError('0000VGO', ExpenseAgentSetup.GetFeatureName(), 'Resolve service endpoint', ExpenseAgentSetupMissingTxt); + exit(false); + end; + + exit(GetExpenseAgentBaseUrl(ExpenseAgentSetup."Use Canary Endpoint", BaseUrl)); + end; + + local procedure GetExpenseAgentBaseUrl(UseCanaryEndpoint: Boolean; var BaseUrl: SecretText): Boolean + var AzureKeyVault: Codeunit "Azure Key Vault"; - SecretName: Text; begin - SecretName := ProdBaseUrlSecretNameTok; - if ExpenseAgentSetup.Get() then - if ExpenseAgentSetup."Use Canary Endpoint" then - SecretName := CanaryBaseUrlSecretNameTok; - exit(AzureKeyVault.GetAzureKeyVaultSecret(SecretName, BaseUrl)); + if UseCanaryEndpoint then + exit(AzureKeyVault.GetAzureKeyVaultSecret(CanaryBaseUrlSecretNameTok, BaseUrl)); + + exit(GetProductionBaseUrl(BaseUrl)); end; local procedure GetProductionBaseUrl(var BaseUrl: SecretText): Boolean @@ -449,19 +460,19 @@ codeunit 6941 "EA Http Client" end; [NonDebuggable] - procedure RegisterErpConfiguration(): Boolean + procedure RegisterErpConfiguration(UseCanaryEndpoint: Boolean): Boolean begin - exit(SendErpConfigRequest('POST', ErpRegistrationFailedErr)); + exit(SendErpConfigRequest('POST', ErpRegistrationFailedErr, UseCanaryEndpoint)); end; [NonDebuggable] - procedure UnregisterErpConfiguration(): Boolean + procedure UnregisterErpConfiguration(UseCanaryEndpoint: Boolean): Boolean begin - exit(SendErpConfigRequest('DELETE', ErpUnregistrationFailedErr)); + exit(SendErpConfigRequest('DELETE', ErpUnregistrationFailedErr, UseCanaryEndpoint)); end; [NonDebuggable] - local procedure SendErpConfigRequest(HttpMethod: Text; FailureError: Text): Boolean + local procedure SendErpConfigRequest(HttpMethod: Text; FailureError: Text; UseCanaryEndpoint: Boolean): Boolean var ExpenseAgentSetup: Record "Expense Agent Setup"; Client: HttpClient; @@ -473,7 +484,7 @@ codeunit 6941 "EA Http Client" Url: Text; BaseUrl: SecretText; begin - if not GetExpenseAgentBaseUrl(BaseUrl) then begin + if not GetExpenseAgentBaseUrl(UseCanaryEndpoint, BaseUrl) then begin Message(FailureError); exit(false); end; diff --git a/src/Apps/W1/ExpenseAgent/app/src/Setup/PageExtensions/EAAgentCard.PageExt.al b/src/Apps/W1/ExpenseAgent/app/src/Setup/PageExtensions/EAAgentCard.PageExt.al index 7633d76b077..90bece3e113 100644 --- a/src/Apps/W1/ExpenseAgent/app/src/Setup/PageExtensions/EAAgentCard.PageExt.al +++ b/src/Apps/W1/ExpenseAgent/app/src/Setup/PageExtensions/EAAgentCard.PageExt.al @@ -41,6 +41,6 @@ pageextension 6995 "EA Agent Card" extends "Agent Card" var ExpenseAgentNotificationId: Guid; - ExpenseAgentInfoMsg: Label 'Additional options are available in the Setup page.'; - OpenSetupLbl: Label 'Open Expense Agent Setup'; + ExpenseAgentInfoMsg: Label 'Use Expense Management Setup to configure general expense and accounting settings. Use Configure to set up the agent.'; + OpenSetupLbl: Label 'Open Expense Management Setup'; } diff --git a/src/Apps/W1/ExpenseAgent/app/src/Setup/Pages/ExpenseAgentSetup.Page.al b/src/Apps/W1/ExpenseAgent/app/src/Setup/Pages/ExpenseAgentSetup.Page.al index 73975a64ce7..cae4a2aae82 100644 --- a/src/Apps/W1/ExpenseAgent/app/src/Setup/Pages/ExpenseAgentSetup.Page.al +++ b/src/Apps/W1/ExpenseAgent/app/src/Setup/Pages/ExpenseAgentSetup.Page.al @@ -7,14 +7,13 @@ namespace Microsoft.ExpenseAgent; using Microsoft.Finance.VAT.Setup; using Microsoft.Foundation.UOM; using System.Agents; -using System.Email; using System.Telemetry; #pragma warning disable AS0031 #pragma warning disable AA0073 page 6996 "Expense Agent Setup" { ApplicationArea = Basic, Suite; - Caption = 'Expense Agent Setup'; + Caption = 'Expense Management Setup'; DeleteAllowed = false; InsertAllowed = false; PageType = Card; @@ -27,10 +26,14 @@ page 6996 "Expense Agent Setup" { group(General) { +#if not CLEAN29 field("Enable Agent"; Rec."Enable Agent") { Editable = false; Visible = false; + ObsoleteState = Pending; + ObsoleteTag = '29.0'; + ObsoleteReason = 'Use Configure Expense Agent to activate or deactivate the agent.'; ToolTip = 'Specifies whether the agent is active in this company. Use the Configure Expense Agent wizard from the agent avatar to activate or deactivate the agent; this page only reflects the current state.'; } field(Mailbox; Rec."Email Address") @@ -39,6 +42,10 @@ page 6996 "Expense Agent Setup" ToolTip = 'Specifies the email account that the agent monitors. You need permission to the mailbox to activate the agent.'; Editable = false; ShowMandatory = true; + Visible = false; + ObsoleteState = Pending; + ObsoleteTag = '29.0'; + ObsoleteReason = 'Use Configure Expense Agent to set up receipt submission.'; trigger OnAssistEdit() var @@ -52,7 +59,12 @@ page 6996 "Expense Agent Setup" } field("Enable Email with Receipts"; Rec."Enable Email with Receipts") { + Visible = false; + ObsoleteState = Pending; + ObsoleteTag = '29.0'; + ObsoleteReason = 'Use Configure Expense Agent to set up receipt submission.'; } +#endif field("Exchange Rate for Expenses"; Rec."Exchange Rate for Expenses") { } @@ -83,10 +95,10 @@ page 6996 "Expense Agent Setup" ObsoleteReason = 'This field is no longer required and will be removed in a future release.'; } #endif - field("Receipt No. Mandatory"; Rec."Receipt No. Mandatory") + field("Create Emp. for Expense Users"; Rec."Create Emp. for Expense Users") { } - field("Merchant Name Mandatory"; Rec."Merchant Name Mandatory") + field("Default VAT Bus. Posting Group"; Rec."Default VAT Bus. Posting Group") { } field("Payment Methods Applied"; Rec."Payment Methods Applied") @@ -97,10 +109,6 @@ page 6996 "Expense Agent Setup" { Importance = Additional; } - field("No. Series Applied"; Rec."No. Series Applied") - { - Importance = Additional; - } field("Exp. Categories Applied"; Rec."Exp. Categories Applied") { Importance = Additional; @@ -109,32 +117,34 @@ page 6996 "Expense Agent Setup" { Importance = Additional; } - field("Management Rules Applied"; Rec."Management Rules Applied") - { - Importance = Additional; - } - field("Create Emp. for Expense Users"; Rec."Create Emp. for Expense Users") - { - } - field("Default VAT Bus. Posting Group"; Rec."Default VAT Bus. Posting Group") - { - Importance = Additional; - } } +#if not CLEAN29 group(Communication) { Caption = 'Communication'; InstructionalText = 'Define how users are notified about unsubmitted expenses and approval events.'; + Visible = false; + ObsoleteState = Pending; + ObsoleteTag = '29.0'; + ObsoleteReason = 'Use Configure Expense Agent to set up outgoing communication.'; group(OutgoingEmail) { Caption = 'Send mail'; + Visible = false; + ObsoleteState = Pending; + ObsoleteTag = '29.0'; + ObsoleteReason = 'Use Configure Expense Agent to set up outgoing communication.'; field("Noreply Email Address"; Rec."Noreply Email Address") { Caption = 'Account'; ToolTip = 'Specifies the email account used for all outgoing Expense Agent messages: pending-approval requests sent to approvers, approved/rejected notifications sent to submitters, reimbursement notifications, and the optional open report reminders. If empty, the main mailbox account is used instead. When no email account is registered, the messages fail silently after the configured number of retries.'; Editable = false; + Visible = false; + ObsoleteState = Pending; + ObsoleteTag = '29.0'; + ObsoleteReason = 'Use Configure Expense Agent to set up outgoing communication.'; trigger OnAssistEdit() begin @@ -145,10 +155,18 @@ page 6996 "Expense Agent Setup" group(OpenReportReminders) { Caption = 'Notify users about unsubmitted reports'; + Visible = false; + ObsoleteState = Pending; + ObsoleteTag = '29.0'; + ObsoleteReason = 'Use Configure Expense Agent to set up unsubmitted-report reminders.'; field("Enable Open Report Notif."; Rec."Enable Open Report Notif.") { ShowCaption = false; + Visible = false; + ObsoleteState = Pending; + ObsoleteTag = '29.0'; + ObsoleteReason = 'Use Configure Expense Agent to set up unsubmitted-report reminders.'; trigger OnValidate() begin @@ -159,40 +177,76 @@ page 6996 "Expense Agent Setup" { Caption = 'Notification frequency'; Enabled = Rec."Enable Open Report Notif."; + Visible = false; + ObsoleteState = Pending; + ObsoleteTag = '29.0'; + ObsoleteReason = 'Use Configure Expense Agent to set up unsubmitted-report reminders.'; } field("Notif. Day of Week"; Rec."Notif. Day of Week") { Enabled = Rec."Enable Open Report Notif." and (Rec."Open Report Notif. Freq." = Rec."Open Report Notif. Freq."::Weekly); + Visible = false; + ObsoleteState = Pending; + ObsoleteTag = '29.0'; + ObsoleteReason = 'Use Configure Expense Agent to set up unsubmitted-report reminders.'; } field("Notif. Day In A Month"; Rec."Notif. Day In A Month") { Enabled = Rec."Enable Open Report Notif." and (Rec."Open Report Notif. Freq." = Rec."Open Report Notif. Freq."::Monthly); + Visible = false; + ObsoleteState = Pending; + ObsoleteTag = '29.0'; + ObsoleteReason = 'Use Configure Expense Agent to set up unsubmitted-report reminders.'; } field("Custom Notif. Formula"; Rec."Custom Notif. Formula") { Enabled = Rec."Enable Open Report Notif." and (Rec."Open Report Notif. Freq." = Rec."Open Report Notif. Freq."::Custom); + Visible = false; + ObsoleteState = Pending; + ObsoleteTag = '29.0'; + ObsoleteReason = 'Use Configure Expense Agent to set up unsubmitted-report reminders.'; } } group(ApprovalNotifications) { Caption = 'Notify users about approval updates'; InstructionalText = 'Sent when reports are submitted, approved, and rejected.'; + Visible = false; + ObsoleteState = Pending; + ObsoleteTag = '29.0'; + ObsoleteReason = 'Use Configure Expense Agent to set up approval notifications.'; field("Enable Approval Notif."; Rec."Enable Approval Notif.") { ShowCaption = false; ToolTip = 'Specifies whether the system sends email notifications when expense reports are submitted, approved, or rejected.'; + Visible = false; + ObsoleteState = Pending; + ObsoleteTag = '29.0'; + ObsoleteReason = 'Use Configure Expense Agent to set up approval notifications.'; } } } +#endif group("Rule & Controls") { + field("Receipt No. Mandatory"; Rec."Receipt No. Mandatory") + { + } + field("Merchant Name Mandatory"; Rec."Merchant Name Mandatory") + { + } field("Use Rules"; Rec."Use Rules") { } +#if not CLEAN29 field("Evaluate Policies"; Rec."Evaluate Policies") { ToolTip = 'Specifies whether the agent evaluates expenses against the configured policies. Rules are evaluated by code, while policies are evaluated by AI, so enabling this consumes additional AI credits.'; + Visible = false; + ObsoleteState = Pending; + ObsoleteTag = '29.0'; + ObsoleteReason = 'Use Configure Expense Agent to set up AI policy evaluation.'; trigger OnValidate() var @@ -208,7 +262,12 @@ page 6996 "Expense Agent Setup" } field("Submitter-run Evaluation"; Rec."Submitter-run Evaluation") { + Visible = false; + ObsoleteState = Pending; + ObsoleteTag = '29.0'; + ObsoleteReason = 'Use Configure Expense Agent to set up AI policy evaluation.'; } +#endif field("Do Not Allow Expenses Older Than"; Rec."Do Not Allow Exp. Older Than") { } @@ -222,6 +281,10 @@ page 6996 "Expense Agent Setup" field("Display Anti-Corruption attestation"; Rec."Enable Anti-Corp. Statement") { } + field("Management Rules Applied"; Rec."Management Rules Applied") + { + Importance = Additional; + } } group(Approval) { @@ -261,17 +324,31 @@ page 6996 "Expense Agent Setup" end; } } +#if not CLEAN29 group(Projects) { Caption = 'Projects'; + Visible = false; + ObsoleteState = Pending; + ObsoleteTag = '29.0'; + ObsoleteReason = 'Use Configure Expense Agent to set up project fields.'; field("Enable Project Fields"; Rec."Enable Project Fields") { + Visible = false; + ObsoleteState = Pending; + ObsoleteTag = '29.0'; + ObsoleteReason = 'Use Configure Expense Agent to set up project fields.'; } field("Project Visibility"; Rec."Project Visibility") { Enabled = Rec."Enable Project Fields"; + Visible = false; + ObsoleteState = Pending; + ObsoleteTag = '29.0'; + ObsoleteReason = 'Use Configure Expense Agent to set up project fields.'; } } +#endif group("Number Series") { field("Expense User Nos."; Rec."Expense User Nos.") @@ -289,6 +366,10 @@ page 6996 "Expense Agent Setup" field("Expense Vendor Nos."; Rec."Expense Vendor Nos.") { } + field("No. Series Applied"; Rec."No. Series Applied") + { + Importance = Additional; + } } group("Allowance") { @@ -348,9 +429,15 @@ page 6996 "Expense Agent Setup" exit(true); end; } +#if not CLEAN29 field("Only Shortest Route"; Rec."Only Shortest Route") { + Visible = false; + ObsoleteState = Pending; + ObsoleteTag = '29.0'; + ObsoleteReason = 'Use Configure Expense Agent to set up mileage routes.'; } +#endif } part(AgentAccessControl; "Expense Agent Access Ctrl") { @@ -445,6 +532,14 @@ page 6996 "Expense Agent Setup" RunObject = Page "EA Billing Overview"; ToolTip = 'View consumption details for the Expense Agent.'; } + action("Expense Agent Status") + { + ApplicationArea = Basic, Suite; + Caption = 'View communication status'; + Image = View; + RunObject = Page "Expense Agent Status"; + ToolTip = 'View scheduled task statuses and errors for incoming mailbox processing, outgoing emails, and reminders.'; + } } area(Promoted) @@ -484,35 +579,15 @@ page 6996 "Expense Agent Setup" Rec.Insert(true); CurrPage.Update(false); end; - - ValidateSelectedMailboxExists(); - ValidateNoreplyMailboxExists(); end; var NotAuthorizedToViewSetupErr: Label 'You do not have permission to view the Expense Agent setup. Contact your administrator to be granted agent management rights.'; +#if not CLEAN29 ActivatePolicyEvalQst: Label 'You are about to activate automated policy evaluation. By doing this, you acknowledge that this feature will consume additional AI credits. Continue?'; +#endif - local procedure ValidateSelectedMailboxExists() - var - EmailAccount: Record "Email Account"; - EmailAccountCU: Codeunit "Email Account"; - begin - if IsNullGuid(Rec."Email Account ID") then - exit; - - EmailAccountCU.GetAllAccounts(false, EmailAccount); - EmailAccount.SetRange("Account Id", Rec."Email Account ID"); - EmailAccount.SetRange(Connector, Rec."Email Connector"); - if not EmailAccount.IsEmpty() then - exit; - - Rec.ClearMailboxAndDependents(); - if Rec."Enable Agent" then - Rec.Validate("Enable Agent", false); - Rec.Modify(); - end; - +#if not CLEAN29 local procedure ScheduleAllTasks() var EAAgentScheduler: Codeunit "EA Agent Scheduler"; @@ -520,24 +595,5 @@ page 6996 "Expense Agent Setup" if Rec."Enable Agent" then EAAgentScheduler.ScheduleAgent(Rec); end; - - local procedure ValidateNoreplyMailboxExists() - var - EmailAccount: Record "Email Account"; - EmailAccountCU: Codeunit "Email Account"; - begin - if IsNullGuid(Rec."Noreply Email Account ID") then - exit; - - EmailAccountCU.GetAllAccounts(false, EmailAccount); - EmailAccount.SetRange("Account Id", Rec."Noreply Email Account ID"); - EmailAccount.SetRange(Connector, Rec."Noreply Email Connector"); - if not EmailAccount.IsEmpty() then - exit; - - Rec."Noreply Email Address" := ''; - Clear(Rec."Noreply Email Account ID"); - Clear(Rec."Noreply Email Connector"); - Rec.Modify(); - end; +#endif } \ No newline at end of file diff --git a/src/Apps/W1/ExpenseAgent/app/src/Setup/Pages/ExpenseAgentSetupWizard.Page.al b/src/Apps/W1/ExpenseAgent/app/src/Setup/Pages/ExpenseAgentSetupWizard.Page.al index 00fba63a99a..d99a610606a 100644 --- a/src/Apps/W1/ExpenseAgent/app/src/Setup/Pages/ExpenseAgentSetupWizard.Page.al +++ b/src/Apps/W1/ExpenseAgent/app/src/Setup/Pages/ExpenseAgentSetupWizard.Page.al @@ -666,10 +666,41 @@ page 6991 "Expense Agent Setup Wizard" } field("Open Report Notif. Freq."; Rec."Open Report Notif. Freq.") { - Caption = 'Notification frequency'; + Caption = 'Frequency'; ToolTip = 'Specifies how often the system should send notifications for open expense reports.'; Enabled = Rec."Enable Open Report Notif."; + trigger OnValidate() + begin + ConfigUpdated(); + end; + } + field("Notif. Day of Week"; Rec."Notif. Day of Week") + { + Caption = 'Day of week'; + Enabled = Rec."Enable Open Report Notif." and (Rec."Open Report Notif. Freq." = Rec."Open Report Notif. Freq."::Weekly); + + trigger OnValidate() + begin + ConfigUpdated(); + end; + } + field("Notif. Day In A Month"; Rec."Notif. Day In A Month") + { + Caption = 'Day of month'; + Enabled = Rec."Enable Open Report Notif." and (Rec."Open Report Notif. Freq." = Rec."Open Report Notif. Freq."::Monthly); + + trigger OnValidate() + begin + ConfigUpdated(); + end; + } + field("Custom Notif. Formula"; Rec."Custom Notif. Formula") + { + Caption = 'Custom formula'; + ToolTip = 'Specifies a date formula for the next reminder date, based on the last reminder run, such as 1D (one day), 1W (one week), or 1M (one month). A result on or before the last run date is moved to the following day.'; + Enabled = Rec."Enable Open Report Notif." and (Rec."Open Report Notif. Freq." = Rec."Open Report Notif. Freq."::Custom); + trigger OnValidate() begin ConfigUpdated(); @@ -737,6 +768,13 @@ page 6991 "Expense Agent Setup Wizard" ConfigUpdated(); end; } + field("Only Shortest Route"; Rec."Only Shortest Route") + { + trigger OnValidate() + begin + ConfigUpdated(); + end; + } field(MileageRateSetupLink; MileageRateSetupLinkTxt) { ShowCaption = false; @@ -835,8 +873,8 @@ page 6991 "Expense Agent Setup Wizard" } group(CanaryGroup) { - Caption = 'Canary'; - InstructionalText = 'Route this environment''s Expense Agent service calls through the canary endpoint.'; + Caption = 'Canary (allowlisted tenants)'; + InstructionalText = 'These settings are shown for allowlisted tenants or when canary is already enabled. Choose whether the agent uses the canary service endpoint.'; Visible = CanaryToggleVisible; field(UseCanaryEndpoint; UseCanaryEndpoint) @@ -847,7 +885,7 @@ page 6991 "Expense Agent Setup Wizard" trigger OnValidate() begin - // Changing the endpoint only takes effect for service calls after this point; it does not automatically re-register the ERP configuration. + // Register and unregister use this selection on Update; changing it does not migrate an existing registration. Rec."Use Canary Endpoint" := UseCanaryEndpoint; Rec.Modify(); ConfigUpdated(); @@ -1034,8 +1072,6 @@ page 6991 "Expense Agent Setup Wizard" UseCanaryEndpoint := Rec."Use Canary Endpoint"; if IsFirstTimeSetup then begin - Rec."Enable Email with Receipts" := true; - Rec."Enable Communication" := true; Rec."Use Rules" := true; ApplyAccountingDefaultsSelection(true); ApplyManagementDefaultsSelection(true); @@ -1323,6 +1359,7 @@ page 6991 "Expense Agent Setup Wizard" local procedure UpdateControls() begin ValidateSelectedMailboxExists(); + ValidateNoreplyMailboxExists(); end; local procedure ConfigUpdated() @@ -1349,10 +1386,33 @@ page 6991 "Expense Agent Setup Wizard" if not EmailAccount.IsEmpty() then exit; + // Stage the repair only; validating Enable Agent here would cancel live tasks before Update. Rec.ClearMailboxAndDependents(); - if Rec."Enable Agent" then - Rec.Validate("Enable Agent", false); Rec.Modify(); + EnableMailboxChanged := true; + ConfigUpdated(); + end; + + local procedure ValidateNoreplyMailboxExists() + var + EmailAccount: Record "Email Account"; + EmailAccountCU: Codeunit "Email Account"; + begin + if IsNullGuid(Rec."Noreply Email Account ID") then + exit; + + EmailAccountCU.GetAllAccounts(false, EmailAccount); + EmailAccount.SetRange("Account Id", Rec."Noreply Email Account ID"); + EmailAccount.SetRange(Connector, Rec."Noreply Email Connector"); + if not EmailAccount.IsEmpty() then + exit; + + Rec."Noreply Email Address" := ''; + Clear(Rec."Noreply Email Account ID"); + Clear(Rec."Noreply Email Connector"); + Rec.Modify(); + EnableMailboxChanged := true; + ConfigUpdated(); end; local procedure ScheduleAllTasks() @@ -1541,7 +1601,7 @@ page 6991 "Expense Agent Setup Wizard" // The Agent service is only reachable on SaaS. Skip ERP registration when running locally to allow testing of the agent without requiring the service. if not EnvironmentInfo.IsSaaSInfrastructure() then exit(true); - exit(EAHttpClient.RegisterErpConfiguration()); + exit(EAHttpClient.RegisterErpConfiguration(Rec."Use Canary Endpoint")); end; local procedure UnregisterErpConfiguration(): Boolean @@ -1551,7 +1611,7 @@ page 6991 "Expense Agent Setup Wizard" begin if not EnvironmentInfo.IsSaaSInfrastructure() then exit(true); - exit(EAHttpClient.UnregisterErpConfiguration()); + exit(EAHttpClient.UnregisterErpConfiguration(Rec."Use Canary Endpoint")); end; local procedure GetExpenseDashboardUrl(): Text diff --git a/src/Apps/W1/ExpenseAgent/app/src/Setup/Pages/ExpenseAgentStatus.Page.al b/src/Apps/W1/ExpenseAgent/app/src/Setup/Pages/ExpenseAgentStatus.Page.al index 0432c31f142..7a4dede2cfb 100644 --- a/src/Apps/W1/ExpenseAgent/app/src/Setup/Pages/ExpenseAgentStatus.Page.al +++ b/src/Apps/W1/ExpenseAgent/app/src/Setup/Pages/ExpenseAgentStatus.Page.al @@ -13,7 +13,7 @@ page 7076 "Expense Agent Status" SourceTableTemporary = true; ApplicationArea = All; UsageCategory = Administration; - Caption = 'Expense Agent Status'; + Caption = 'Expense Agent Communication Status'; Editable = false; layout