From 6f72dc92601746efdbafa12c5a1433fa04d9ead2 Mon Sep 17 00:00:00 2001 From: Kilian Seizinger <56249171+pri-kise@users.noreply.github.com> Date: Fri, 9 Jan 2026 07:46:19 +0100 Subject: [PATCH] Correct Cleanup of IsolatedStorage on Deletion of SMTP Account --- .../app/src/SMTPAccount.table.al | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Apps/W1/Email - SMTP Connector/app/src/SMTPAccount.table.al b/Apps/W1/Email - SMTP Connector/app/src/SMTPAccount.table.al index 98478ceb85..9805b84f96 100644 --- a/Apps/W1/Email - SMTP Connector/app/src/SMTPAccount.table.al +++ b/Apps/W1/Email - SMTP Connector/app/src/SMTPAccount.table.al @@ -147,8 +147,9 @@ table 4511 "SMTP Account" trigger OnDelete() begin - if not IsNullGuid(Rec."Password Key") then - if IsolatedStorage.Delete(Rec."Password Key") then; + DeleteIsolatedStorageIfExists(Rec."Password Key"); + DeleteIsolatedStorageIfExists(Rec."Client Id Storage Id"); + DeleteIsolatedStorageIfExists(Rec."Client Secret Storage Id"); end; [NonDebuggable] @@ -213,4 +214,12 @@ table 4511 "SMTP Account" if not IsolatedStorage.Get(Format(ClientSecretKey), DataScope::Company, ClientSecret) then Error(UnableToGetClientSecretMsg); end; + + local procedure DeleteIsolatedStorageIfExists(KeyToCheck: Guid) + begin + if IsNullGuid(KeyToCheck) then + exit; + if IsolatedStorage.Contains(Format(KeyToCheck), DataScope::Company) then + IsolatedStorage.Delete(Format(KeyToCheck), DataScope::Company); + end; } \ No newline at end of file