Block deletion of data records for every role and group

Dear Community,

 

is there any way to block the deletion of records of an object for all users and user groups (including system administrators and the supervisor) depending on a lookup value, such as a status.

Adjusting the object permissions still let's sysadmins delete a record.

 

Like 0

Like

1 comments

Hello Markus,

You can write your own EventListeren on onDeletnig event and if your condition is satisfied, you can call base.OnDeleting(sender, e).

If not, it will block the delete action no matter who is the user.

public override void OnDeleting(object sender, EntityBeforeEventArgs e) {
				var entityOrderProduct = (Entity)sender;
            	var OrderProductid = entityOrderProduct.PrimaryColumnValue;
				string name = entityOrderProduct.GetTypedColumnValue<string>("Name");
				if (name != 'someting'){
					base.OnDeleting(sender, e);
				}
			}

 

Show all comments