diff --git a/src/System Application/App/User Details/src/UserDetailDateFilter.Enum.al b/src/System Application/App/User Details/src/UserDetailDateFilter.Enum.al
new file mode 100644
index 0000000000..a865626d40
--- /dev/null
+++ b/src/System Application/App/User Details/src/UserDetailDateFilter.Enum.al
@@ -0,0 +1,29 @@
+// ------------------------------------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for license information.
+// ------------------------------------------------------------------------------------------------
+
+namespace System.Security.User;
+
+
+///
+/// Used for setting date flow filters against the Last Login time field on the user details page.
+///
+enum 774 "User Detail Date Filter"
+{
+ value(0; Blank)
+ {
+ }
+ value(1; "7 Days")
+ {
+ Caption = '7 Days';
+ }
+ value(2; "30 Days")
+ {
+ Caption = '30 Days';
+ }
+ value(3; "90 Days")
+ {
+ Caption = '90 Days';
+ }
+}
\ No newline at end of file
diff --git a/src/System Application/App/User Details/src/UserDetails.Page.al b/src/System Application/App/User Details/src/UserDetails.Page.al
index da33aaece1..2363a794a5 100644
--- a/src/System Application/App/User Details/src/UserDetails.Page.al
+++ b/src/System Application/App/User Details/src/UserDetails.Page.al
@@ -6,16 +6,18 @@
namespace System.Security.User;
using System.Environment;
+using System.Security.AccessControl;
+using System.Utilities;
///
/// Shows detailed user information, such as unique identifiers, information about permission sets etc.
///
page 774 "User Details"
{
- AboutText = 'View the additional information about users in a list view, which allows for easy searching and filtering.';
+ AboutText = 'View detailed user information, such as unique identifiers, information about permission sets, login activity etc. in a list view, which allows for easy searching and filtering.';
AboutTitle = 'About the users detailed view';
ApplicationArea = Basic, Suite;
- Caption = 'Users';
+ Caption = 'Users (Detailed View)';
DeleteAllowed = false;
Editable = false;
InsertAllowed = false;
@@ -67,6 +69,36 @@ page 774 "User Details"
ToolTip = 'Specifies ID assigned to the user in Microsoft Entra.';
Visible = IsSaaS;
}
+ field("Last Login Date"; Rec."Last Login Date")
+ {
+ Caption = 'Last Login Date';
+ ToolTip = 'Specifies the date and time when the user last logged in.';
+ }
+ field("Inactive Days"; InactiveDays)
+ {
+ Caption = 'Inactive (days)';
+ ToolTip = 'Specifies the number of days since the user last logged in.';
+ }
+ field(SystemCreatedAt; SystemCreatedAt)
+ {
+ Caption = 'Created On';
+ ToolTip = 'Specifies the date and time when the user record was created.';
+ }
+ field(CreatedBy; CreatedByUser."User Name")
+ {
+ Caption = 'Created By';
+ ToolTip = 'Specifies the user who created the user record.';
+ }
+ field(SystemModifiedAt; SystemModifiedAt)
+ {
+ Caption = 'Modified On';
+ ToolTip = 'Specifies the date and time when the user record was last modified.';
+ }
+ field(ModifiedBy; ModifiedByUser."User Name")
+ {
+ Caption = 'Modified By';
+ ToolTip = 'Specifies the user who last modified the user record.';
+ }
// Can be added with "Personalize"
field("Has SUPER permission set"; Rec."Has SUPER permission set")
{
@@ -89,6 +121,21 @@ page 774 "User Details"
Caption = 'Users with SUPER permission set';
Filters = where("Has SUPER permission set" = const(true));
}
+ view("7 Days")
+ {
+ Caption = 'Inactive 7 days';
+ Filters = where("Inactive Days Date Filter" = const("7 Days"));
+ }
+ view("30 Days")
+ {
+ Caption = 'Inactive 30 days';
+ Filters = where("Inactive Days Date Filter" = const("30 Days"));
+ }
+ view("90 Days")
+ {
+ Caption = 'Inactive 90 days';
+ Filters = where("Inactive Days Date Filter" = const("90 Days"));
+ }
}
trigger OnOpenPage()
@@ -100,6 +147,47 @@ page 774 "User Details"
UserDetails.Get(Rec);
end;
+ trigger OnFindRecord(Which: Text): Boolean
+ var
+ UserDetails: Record "User Details";
+ begin
+ Rec.SetRange("Last Login Date");
+ if Rec.GetFilter("Inactive Days Date Filter") <> '' then
+ if Evaluate(UserDetails."Inactive Days Date Filter", Rec.GetFilter("Inactive Days Date Filter")) then
+ case UserDetails."Inactive Days Date Filter" of
+ Rec."Inactive Days Date Filter"::"7Days":
+ Rec.SetFilter("Last Login Date", '<=%1', CreateDateTime(CalcDate('<-7D>', Today()), CurrentDateTime().Time));
+ Rec."Inactive Days Date Filter"::"30Days":
+ Rec.SetFilter("Last Login Date", '<=%1', CreateDateTime(CalcDate('<-30D>', Today()), CurrentDateTime().Time));
+ Rec."Inactive Days Date Filter"::"90Days":
+ Rec.SetFilter("Last Login Date", '<=%1', CreateDateTime(CalcDate('<-90D>', Today()), CurrentDateTime().Time));
+ else
+ OnInactiveDaysFilterCaseElse(UserDetails."Inactive Days Date Filter", Rec);
+ end;
+
+ exit(Rec.Find(Which));
+ end;
+
+ trigger OnAfterGetRecord()
+ var
+ Math: Codeunit Math;
+ begin
+ if CreatedByUser.Get(Rec.SystemCreatedBy) then;
+ if ModifiedByUser.Get(Rec.SystemModifiedBy) then;
+ if Rec."Last Login Date".Date <> 0D then
+ InactiveDays := Math.Floor(Today() - Rec."Last Login Date".Date);
+ end;
+
+ var
+ CreatedByUser: Record User;
+ ModifiedByUser: Record User;
+ InactiveDays: Integer;
+
protected var
IsSaaS: Boolean;
+
+ [IntegrationEvent(false, false)]
+ local procedure OnInactiveDaysFilterCaseElse(DateFilter: Enum "User Detail Date Filter"; var Rec: Record "User Details")
+ begin
+ end;
}
\ No newline at end of file
diff --git a/src/System Application/App/User Details/src/UserDetails.Table.al b/src/System Application/App/User Details/src/UserDetails.Table.al
index 34100bacc4..3f4b015a0c 100644
--- a/src/System Application/App/User Details/src/UserDetails.Table.al
+++ b/src/System Application/App/User Details/src/UserDetails.Table.al
@@ -116,6 +116,27 @@ table 774 "User Details"
Editable = false;
FieldClass = FlowField;
}
+ ///
+ /// The last login date of the user.
+ ///
+ field(24; "Last Login Date"; DateTime)
+ {
+ Access = Internal;
+ Caption = 'Last Login Date';
+ Editable = false;
+ FieldClass = FlowField;
+ CalcFormula = Lookup("User Login"."Last Login Date" where("User SID" = field("User Security ID")));
+ }
+ ///
+ /// Flow filter for filtering users based on Last Login Date.
+ ///
+ field(25; "Inactive Days Date Filter"; Enum "User Detail Date Filter")
+ {
+ Access = Internal;
+ Caption = 'Inactive Days Date Filter';
+ Editable = false;
+ FieldClass = FlowFilter;
+ }
}
keys