cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
bsoares
Helper III
Helper III

Warning if someone is using app

Hi all!

 

Is possible to create a warning to know if someone is using the app at the same moment?

Like in Excel when we open a file and pop up saying the file is being used by another user.

Just avoid some info being erased or overwritte.

 

Thanks!

7 REPLIES 7
PowerRanger
Super User
Super User

@bsoares 

 

As far as I know this is not possible out of the box. I'm also not aware of a OnExit or onClose Event to figure out if someone has exit the app which would be rquired in this scenario.

 

But you could do some kind of a hack:

 

Add a Timer Control on your app. Set AutoStart and Repeat to true. Duration 10 seconds

OnTimerEnd you could add a logic which

  1. creates a ListItem on SharePoint and updates this item with the current user name in the Title field
  2. Checks within this SharePoint List if there are other items where the modified date column got modified in the past 20 seconds.

If there are items modified within the last 20 seconds you know others are using the app or at least have it opend.

 

You could then also create a flow which deletes these entries every day. so the List doesn't grow that much.

 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

 




​Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item.

If the content was useful in other ways, please consider giving it Thumbs Up.

@bsoares 

 

Be aware that this might have huge impact on the users API usage

 

See:Requests limits and allocations - Power Platform | Microsoft Docs

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.




​Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item.

If the content was useful in other ways, please consider giving it Thumbs Up.

@PowerRanger Thanks for your help! I'll give a try!

mdevaney
Super User
Super User

@bsoares 
There is a way to check if a record was modified or deleted since you entered the form.

 

Suppose your datasource is SharePoint.  Every SharePoint list item has a modified time.  You can obtain it like this when the record is opened in Power Apps.

 

Set(varModifiedTime, LookUp(your_datasource_name, ID=1, Modified))

 

 

Then right before you submit the form with changes you can lookup the modified time again to see if it changed.  If there are no changes, submit the form.  If there were changes, notify the user.

 

If(varModifiedTime = LookUp(your_datasource_name, ID=1, Modified),
    SubmitForm(Form1);
    Notify("Record was changed or deleted since opening"
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

@mdevaney I'll try it and let you know if it works! Thanks!

@mdevaney  Sorry for asking, but where should I put/apply the codes you provided?

@bsoares 

This code goes in the OnSelect property of the gallery you use to navigate to a record

Set(varModifiedTime, LookUp(your_datasource_name, ID=ThisItem.ID, Modified));
Navigate(your_screen_with_form);

 

This code goes in the OnSelect property of the submit button for a form.

If(varModifiedTime = LookUp(your_datasource_name, ID=Gallery1.Selected.Value, Modified),
    SubmitForm(Form1);
    Notify("Record was changed or deleted since opening"
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (4,433)