cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

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

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! 

 

 

6 REPLIES 6
Super User II
Super User II

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.




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.

Power Apps Portals Super User


Oliver Rodrigues


 

Microsoft
Microsoft

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?

Helper II
Helper II

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

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, thanks. Can you please help me with understanding pot request. how to call that from portal page load. 

thanks in adavance

 

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.

Helpful resources

Announcements
secondImage

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

Users online (41,154)