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