cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sgray1
Level: Powered On

Limit users from editing same data entry

Hi all,

I have built an app to enter data into a SharePoint list.  If two users try to edit the same existing data entry at the same time only the first user to open the entry will have the changes to the data saved and any changes made by the second user will be lost.  Is there a way to limit the number of users that can open an existing dat 1 user?

 

Thanks in advanced

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Limit users from editing same data entry

Hi @sgray1 ,

You could set the select item's button's OnSelect:

(I assume that it is the arrow button in the gallery)

1238.PNG

 

If(LookUp(list2,list1ID=gallery1.Selected.ID,whether update)=false,
   Notify("someelse is updating this record!",NotificationType.Warning),
   If(IsEmpty(list2,list1ID=gallery1.Selected.ID),
      Patch(list2,Defalts(list2),{list1ID:gallery1.Selected.ID,whether update: false}),
      Patch(list2,LookUp(list2,list1ID=gallery1.Selected.ID),{whether update: false})
      );Navigate(EditForm screen)
    )

//test the whether update field, if it is false , then some is editing, show notifation.

If it is not false, then you could edit.Firstly, update whether update field to false( use gallery.Selected.ID could represent the selected item's Id) and navigate to edit form screen.

Then in the edit form screen, set the submit button's OnSelect:

(submit the form and update the whether update field.

SubmitForm(Form1);Patch(list2,LookUp(list2,list1ID=gallery1.Selected.ID),{whether update: true})

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Super User
Super User

Re: Limit users from editing same data entry

Hi,

 

You could use a second list to store a boolean value and the ID of the row being opened, that way you can do a check for that boolean value before you get them to the edit screen and if it's true then don't allow them to navigate to the edit screen.

 

Then during your Submit function for edits, make sure to have it patch the second list to return the boolean value for that item to 0,

 

Cheers,

ManCat




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!
sgray1
Level: Powered On

Re: Limit users from editing same data entry

Thanks for your reply ManCat,

I under stand what you are suggesting, however, only having a basic knowledge of Power Apps I'm not sure how to go about storing the data entry ID valve and toggling a boolean in a second SharePoint list when the edit button OnSelect function is run.

 

Thanks again

 

sgray1

Community Support Team
Community Support Team

Re: Limit users from editing same data entry

Hi @sgray1 ,

You could set the select item's button's OnSelect:

(I assume that it is the arrow button in the gallery)

1238.PNG

 

If(LookUp(list2,list1ID=gallery1.Selected.ID,whether update)=false,
   Notify("someelse is updating this record!",NotificationType.Warning),
   If(IsEmpty(list2,list1ID=gallery1.Selected.ID),
      Patch(list2,Defalts(list2),{list1ID:gallery1.Selected.ID,whether update: false}),
      Patch(list2,LookUp(list2,list1ID=gallery1.Selected.ID),{whether update: false})
      );Navigate(EditForm screen)
    )

//test the whether update field, if it is false , then some is editing, show notifation.

If it is not false, then you could edit.Firstly, update whether update field to false( use gallery.Selected.ID could represent the selected item's Id) and navigate to edit form screen.

Then in the edit form screen, set the submit button's OnSelect:

(submit the form and update the whether update field.

SubmitForm(Form1);Patch(list2,LookUp(list2,list1ID=gallery1.Selected.ID),{whether update: true})

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

sgray1
Level: Powered On

Re: Limit users from editing same data entry

Thanks, Ill give this a go.

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,700)