cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Regular Visitor

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

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 II
Super User II

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


@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


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

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

Thanks, Ill give this a go.

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (52,293)