Category: How do I do X?
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

How to handle multiple users on the same page

Issue

I am building internal tools with multiple users working on the same page, such as an ops tool where the team can see all incoming orders. How can I avoid multiple team members working on the same customer without assigning orders beforehand? I need to come up with a way to manage this efficiently.

Resolution

The solution proposes implementing an order assignment system to avoid multiple team members working on the same customer. When a user opens an order, it should be automatically assigned to them, and the team should be able to see who has been assigned to the order. To ensure that the information is up to date, the app should use polling to retrieve the assignee every few seconds.

The sample app provided by Appsmith demonstrates how to use polling to check if an order has been assigned to another user. Using the JavaScript setTimeout() method, the app queries the backend every few seconds to get the latest assignee for each order. If an order is already assigned to a user, the app shows a message indicating who has the order. If the order is not assigned to anyone, the user can claim the order by clicking a button.

Implementing an order assignment system can help prevent conflicts when multiple team members are working on the same order. The solution requires setting up a few UI components and implementing the backend API endpoints to manage assignments. By using polling to keep track of assignments, the app can ensure that team members are always working on the most up-to-date information. Overall, this solution provides a scalable and reliable way to manage multiple users on the same page.