Hi,
We are using the below SQL query for Dynamics 365 on prem to find the 'LastAccessTime' of user accounts. This was working in CRM 2011 and has worked for some Dynamics 365 instances intermittently, but mainly this column comes out as NULL for most users, even though they have logged on and are using the system. Auditing is enabled. Does anyone know why this might be happening? We suspect it could be when we are using HTTPS that it doesnt work?
SELECT ORG.FriendlyName as ‘Organization Name’, SU.Name as ‘User Name’
,SUO.LastAccessTime as ‘Last Login’
FROM MSCRM_CONFIG.dbo.SystemUser SU
INNER JOIN [MSCRM_CONFIG].[dbo].[SystemUserOrganizations] SUO ON SUO.UserId = SU.Id
Inner Join [MSCRM_CONFIG].[dbo].[Organization] ORG on ORG.Id = SUO.OrganizationId
INNER JOIN [MSCRM_CONFIG].[dbo].[SystemUserAuthentication] SUA ON SUA.UserId = SUO.UserId
where SU.Name != ‘NULL’
ORDER BY SUO.LastAccessTime DESC