Prevent the user from updating or deleting a specific record #6788
abualmazen
started this conversation in
General
Replies: 2 comments
-
Add this to your delete handler: protected override void OnBeforeDelete()
{
base.OnBeforeDelete();
if (Row.CustomerName.Equals("Default", StringComparison.OrdinalIgnoreCase))
throw new ValidationError("Default customer cannot be deleted.");
} and this to your save handler protected override void BeforeSave()
{
base.BeforeSave();
if (IsUpdate && Row.CustomerName.Equals("Default", StringComparison.OrdinalIgnoreCase))
throw new ValidationError("Default customer cannot be updated.");
} You can also add some code to your Dialog.ts protected updateInterface(): void {
super.updateInterface();
if (this.form.CustomerName.value == 'Default') {
this.toolbar.findButton('apply-changes-button').hide();
this.toolbar.findButton('delete-button').hide();
this.toolbar.findButton('save-and-close-button').hide();
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thank You very much |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi
How i can Prevent the user from updating or deleting a specific record
for example i have record in customers table name default customer
i want if user want to delete or update it i want display msg you can not update or delete default customer
Beta Was this translation helpful? Give feedback.
All reactions