Skip to main content
Community site session details

Community site session details

Session Id :
Power Pages - Power Apps Portals
Unanswered

Is there any way to get currently logged-in User's data in D365 Portal/CRM

(0) ShareShare
ReportReport
Posted on by 29

Hello, 

         we have requirement to process the currently singed in users in portal. ayn idea how to get all the users which are currently logged in? or how to identify if particular contact is currently logged in or not ?

 

thanks! 

 

 

  • justinburch Profile Picture
    Microsoft Employee on at
    Re: Is there any way to get currently logged-in User's data in D365 Portal/CRM

    Hi @PoojaD,

    Based on your information, I don't suggest using PowerApps Portals. What you are asking will require server-side management that you won't find availability for. Even if you use Oliver's recommendation to identify the number of users currently "logged in", preventing a login (especially dependent on your authentication approach) is going to be a nightmare, if even possible. Multiple concerns for this request:

    1. You will likely need an active pinging process for logged in users that will constantly ping an endpoint you've setup to identify a user is logged in and using the site
    2. What if a user steps away from their browser to respond to an email for 10 minutes - do they get logged out? What about the data they were working with?
    3. Are you expecting a queue process where first come, first serve is honored? Or whoever happens to login at the time the 5th position is relinquished?
    4. How do you setup for error handling in authentication ("sorry, 5 people are already logged in") for a web application you don't have server-side access to?

    Not expecting answers to these, just trying to present concerns I have for the approach. I'd recommend a fully custom application.

  • Pooja Bhagwat Profile Picture
    29 on at
    Re: Is there any way to get currently logged-in User's data in D365 Portal/CRM

    @eliz_talent, thanks. Can you please help me with understanding pot request. how to call that from portal page load. 

    thanks in adavance

     

  • Pooja Bhagwat Profile Picture
    29 on at
    Re: Is there any way to get currently logged-in User's data in D365 Portal/CRM

    thanks Justin, basically my requirement to maintain track of contact logged in currently . suppose 5 users are logged in and working on portal, if 6th person comes and try to login to portal, he should able to access features of portal . if one person is logged out from currently 5 , then 6th person can log in. 

     

     

  • eliz_talent Profile Picture
    98 on at
    Re: Is there any way to get currently logged-in User's data in D365 Portal/CRM

    You can use {% user.contact %} to get current contact information and onload of the home page call a power automate with pot request, where you will store data about logged in user

  • justinburch Profile Picture
    Microsoft Employee on at
    Re: Is there any way to get currently logged-in User's data in D365 Portal/CRM

    Hi @PoojaD,

    As Oliver mentioned, Login Tracking is the simplest approach within CDS, but this field is deprecated (https://docs.microsoft.com/en-us/powerapps/maker/portals/faq#login-tracking-enabled) and not recommended for use - Microsoft's recommendation is to utilize an insights/analytics service. Even still, you will need to define what is considered "currently signed in" - is it someone who last logged in 30 mins or less (using login tracking) or last visited a page 30 seconds or less ago (using insights)?

    What is the purpose of the request?

  • oliver.rodrigues Profile Picture
    9,342 Most Valuable Professional on at
    Re: Is there any way to get currently logged-in User's data in D365 Portal/CRM

    Hi

    My first guess here would be using the last successful sign-in field from the contact records

     

    • you need to set the Site Settings Authentication/LoginTrackingEnabled to true
    • for every sign-out there is a security stamp that is updated against the Contact record (adx_identity_securitystamp), as far as I remember it doesn't get updated on the login
    • you can create a new field for "last successful logout" and then populate via workflow after the Security Stamp is updated

    This way you would have both sign-in datetime and sign-out datetime.. now you can retrieve logged-in users

    I haven't done this myself, but should work

     

     

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Pages

#1
Lucas001 Profile Picture

Lucas001 60 Super User 2025 Season 1

#2
Fubar Profile Picture

Fubar 55 Super User 2025 Season 1

#3
surya narayanan Profile Picture

surya narayanan 35