Question

Before delete object, run validation and cancel delete if failed

Hi,

I need to add a validation process before a record is deleted to ensure it can be deleted.

I tried using the 'Before record deleted' event in the Object structure and call the validation from the object process.

My problem is that I don't know how to cancel the delete action when validation fails.

Any ideas?

Thanks,

Chani

Like 0

Like

1 comments

Hi Chani,

 

Throw any exception in the method you call when the before delete signal is started and the record will not be deleted. Something like:

public void ThrowDeleteException() {
			throw new InvalidOperationException("Can't delete");
		}

Best regards,

Oscar

Show all comments