cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Patron
Post Patron

Prevent a User from Altering a Record

Is there a way to prevent a user from altering a record?

 

I'm using Azure SQL as my database.

 

Say I have an inventory system. In it, my users can mark an item as IN-SERVICE, NOT-ISSUED, or SCRAP.  If a user marks an item as SCRAP, that item will be scheduled for destruction.

 

I still want to keep an archive of all the items we've had in our inventory.  So if a user marks an item as SCRAP, is it possible to make that record locked from editing?

 

Another option that I'm looking into is moving the record that is marked as SCRAP to a different table. Does PowerApps have the ability to move a record from one table to another?.

 

v/r

Brendon

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Impactful Individual
Impactful Individual

Or if this item is selected from a gallery just add into the filter that the status doesnt equal scrap. ie:

 

Filter(TableName,Not(Status = "SCRAP"))

View solution in original post

6 REPLIES 6
Highlighted
Impactful Individual
Impactful Individual

Dont think you can lock a row.  But you can do the second one:

 

you can use the patch function to add a new record to the new table:

 

ForAll(Filter(OriginalTable,FieldName="Scrap"),Patch(NewTable,Defaults(NewTableName),{OldID:ID,Field1:Field1,Field2:Field2,etc,etc,etc}))

 

youll have to make the new table first and ensure fields match, you dont have to copy all fields, but youll proably want to add a column OldID in order to preserve the ID from the original table, as shown above.

Highlighted

Thanks @Delid4ve for your suggestion. I'll give that a try this afternoon. 

 

 

Highlighted
Power Participant
Power Participant

Even if you cannot lock the record diretcly in the DB, you can prevent the user from getting to the edit screen in your app. I assume you have the records in a data table or a gallery with a function via an icon or a button go to go an edit screen. 

 

You can set icon's/button's Editmode depending on the status, something like

 

Icon/Button.DisplayMode:

If(ThisItem.Status = "SCRAP", DisplayMode.Disabled, DispalyMode.Edit)

 

Good luck!

 

Highlighted
Impactful Individual
Impactful Individual

Or if this item is selected from a gallery just add into the filter that the status doesnt equal scrap. ie:

 

Filter(TableName,Not(Status = "SCRAP"))

View solution in original post

Highlighted

I think this option might be a good temporary fix for the time being while I figure out the best couse of action. I ran some tests with your previous suggestion and it worked out just fine. 

Highlighted

I think this option might be a good temporary fix for the time being while I figure out the best couse of action. I ran some tests with your previous suggestion and it worked out just fine. 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (11,874)