Simplest way to do is by creating new list for tracking app locking
1. Create SharePoint List with fields like buttonName ( single line of text ) , IsLocked ( Yes / no) and Lockedby (Person)
2. Add data to the list for each button
3. When user clicks on button1 , Patch the Button1 record with islock as true and locked by current user details
If(
LookUp(LockingList, ButtonName = "Button1").IsLocked ,
Notify("This button is currently locked by another user.", Warning),
Patch(
LockingList,
LookUp(LockingList, ButtonName = "Button1"),
{
IsLocked: true,
LockedBy: {
Claims: User().Email,
Department: "",
DisplayName: User().FullName,
Email: User().Email,
JobTitle: "",
Picture: User().Image
}
}
);
Navigate(GalleryScreen, Fade)
)
4. Add button to refresh to check if lock is removed.
Refresh(LockingList)
5. Add button for user to release the lock
Patch(
LockingList,
LookUp(LockingList, ButtonName = "Button1"),
{
IsLocked: false,
LockedBy : Blank()
}
)