Update data real time from other user screen

Hello, I can’t take it anymore, I guess data hooks will help me with this but im not sure how to do it.
Here is what I want to happen. I created an admin page, and I have 2 admin users assuming they have different screen or pc/laptop. If the admin 1 updates data on the database collection, I want the screen of the admin 2 updates the display automatically without refreshing the page ( of admin 2 ).

Ex. 10 requests displays on both screen of Admin 1 and Admin 2 .
Now Admin 1 VALIDATES then accepts request no.1 , that makes his screen display 9 request remaining.

On the Admin 2 screen it will update automatically into 9 request remaining without refreshing the page. (Because page refresh is bad for a user, that is what i want to happen.)

And lastly if I may add, What will happen of both Admin 1 and Admin 2 VALIDATES request no.1 without both knowing it? When button validates is clicked it will flag admin 2 that this request is being validated. I wish to avoid duplicate process, accepts or validates.

Data hooks afterupdate()? Can someone give me a simple example that performs this kind of scenario. Thank you in advance.

Hello.

You can run dataset’s refresh inside afterUpdate hook. This ensures that only the dataset is reloaded and not the whole page.

As for the validation question, it’s all down to your implementation of the validation process. Should you need further assistance, share what you think you did right, what you’ve tried to do, and what’s blocking you. Include any relevant screenshots, code, and URLs to make it easier for others to understand the problem.

Good luck!

Hello I tried adding dataset refresh on my afterUpdate hook but i got an error, im not using dataset when I update my data collection, im using code to update it. Please check my attached images

afterUpdate Hook Error

Code UPDATE DATA
When approve button clicked it will update the data of the selected data collection.

I want after I approve it will also update the total number of new applicants without refreshing the page. I count the total number of PENDING Status to display new applicants. Once I clicked APPROVED button upon validation from PENDING Status it will change to APPROVED.

Note: I am on 1 page only, I used Hide/Show function. I’ll show the validation box when I click validate, then there is an approved button inside that validation box.