Hi all,
I am having an issue with the differences between the live app and the app preview. I have a datatable that is going to be the source for my records. I want users to be able to add and delete from this table, but I also want to have the ability for "management" to lock out specific rows to prevent accidental deletion. I am currently doing this via a ISLocked Yes/no column in the table, that I hope to figure out how to lock out to specific users in case they do access the table itself.
I am using the following formula to do this,
If(
!IsBlank(
LookUp(
'PN-PD-PM Tables',
cr3c2_pnpdpmtableid = PartNumberGallery.Selected.cr3c2_pnpdpmtableid && IsLocked = true
)
),
Notify("This item is locked and cannot be deleted.", NotificationType.Error),
IfError(
Remove(
'PN-PD-PM Tables',
LookUp(
'PN-PD-PM Tables',
cr3c2_pnpdpmtableid = PartNumberGallery.Selected.cr3c2_pnpdpmtableid && IsLocked = false
)
),
Notify("You are not allowed to delete items.", NotificationType.Error)
);
// Only runs if Remove succeeds
Notify("Item deleted successfully.", NotificationType.Success);
Set(varToDelete_Parts, Blank());
Back()
)
But it appears that it only seems to work on the app preview. Once I navigate to the live app, it prevents the record from being deleted and sends the user back to the gallery. The problem is it is currently displaying the "Item deleted successfully" error (which it shouldn't because the item is locked) but not displaying the item is locked and cannot be deleted.
I have been using AI to help me build this, but it appears stuck on this loop. I can correct the notifications, but then I loose the ISLocked function and it deletes the record regardless.
Perhaps there is a different way to accomplish this...?