Skip to main content
January 16, 2023
Question

List of users who have opened the same record for either viewing or editing

  • January 16, 2023
  • 10 replies
  • 0 views

Hi Team,

I have a requirement where I have to show the list of users who have opened same record in a site.

I have record type with 'related actions' to view the record details, my requirement is if user A has already opened the record and if another user B opens the same record, then both of them should be able to see on the summary page that the other user has also opened the same record.

We don't need to lock the record rather just display who all are viewing the same record at the same time.

Any help is appreciated.

Thank you

    10 replies

    komalj3844
    January 16, 2023

    Hi 

    Please have a look to documentation https://docs.appian.com/suite/help/22.4/Logging.html#records-usage

    This will provide you the user uuid list accessing the record. WIth the help of user function you can get the user name . for that 

    add all users in a loop and check whose uuid is matching

    January 19, 2023

    Hi Komalj,

    Thank you for your suggestion.

    I am trying this.

    mikes0011
    Brainy
    January 16, 2023

    "user who's currently viewing the record at the same time" is essentially impossible because there is no way to know (beyond super-vague guessing) when a user has stopped viewing that record.

    The Expression Guru
    stewart.burchell
    January 16, 2023

    What would your users do with the information that another user is concurrently viewing the same record? (I'm curious as to the business requirement here, not the "how do we do this?" detail)

    January 17, 2023

    Hi Stewart,

    Once the user knows that another user is viewing it, they would ideally not work on the same record. 

    stewart.burchell
    January 17, 2023

    If that's the ideal then why not use a pessimistic locking solution to actively prevent two users working ion the same record? Once a User has a lock then you can then decide what level of access other Users can have to that same record - either being able to access for read-only, or not even access it at all. The beauty of this pattern is that you can surface who has the lock so User B can see that User A is currently working on the record.

    community.appian.com/.../pessimistic-locking

    harshitb6843
    January 16, 2023

    Hi. 

    This sounds achievable but with a catch. The easiest part of it is to store the username when someone opens a record. The hardest part it to clear the user context when they exit because user take no such action to exit which can be captured by Appian like clicking on a button or a link. 
    So for that part, you have to assume a time (like 10 mins) or similar for which you think you user will keep the interface open. 

    When you are good with the above part, you can simply use the text cache plugin and append the userContext to a cache (keep the ID of the record as the key) in the first local variable. 

    And in the code, you can use that variable to show the list of users who are accessing it. Now just set the timeout of that cache to the limit you might have decided and that should do most of the work. 

    mikes0011
    Brainy
    January 16, 2023
    you can simply use the text cache plugin and append the userContext to a cache

    It's also fairly easy to do OOB with a simple call to a specialized (but small/easy) stored procedure, which accepts the viewer's username and optionally, context (like the current site being viewed from, etc).

    The Expression Guru
    January 17, 2023

    Hi Mike,

    Thank you. I would try the above mentioned solutions and let you know if it worked.