web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

User last access time is sometimes NULL

(0) ShareShare
ReportReport
Posted on by 306

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

*This post is locked for comments

I have the same question (0)
  • Alexandr J.  Profile Picture
    246 on at
    RE: User last access time is sometimes NULL

    Hi,

    try to check these topics:

    https://community.dynamics.com/crm/f/117/p/294259/844854#844854

    https://community.dynamics.com/crm/f/117/t/208081

    Kind regards,

    Alex

  • Verified answer
    mluce Profile Picture
    306 on at
    RE: User last access time is sometimes NULL

    Ah!  Seen that it has stopped being logged with Dynamics 365.  Found answer here and a way around it;

    www.mscrmsolution.com/.../User-Access-Audit-Get-Last-Login-Date-Time-for-CRM-User

    1. Execute below SQL query against your CRM Organization database to find out the last login date and time for users.
        SELECT 
             su.SystemUserId
            ,su.DomainName
            ,su.FullName
            ,max(a.CreatedOn) as LastAccessTime  
        FROM Audit a
        INNER JOIN SystemUser su 
            on a.ObjectId = su.SystemUserId
        WHERE a.Operation = 4 
            and su.IsDisabled = 0
        GROUP BY  su.SystemUserId, su.DomainName, su.FullName
  • Suggested answer
    Nishant Rana Profile Picture
    11,325 Microsoft Employee on at
    RE: User last access time is sometimes NULL

    This should help in case of online

    nishantrana.me/.../

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans