on 2025 Jan 31 12:33 PM
Hi,
I have a very basic requirement in RAP. I want to implement a validation on a given field when the user deletes an entity (reject the deletion if a given field has a given value)
So I used this syntax in the Behavior Definition
validation checkDelete on save {delete;}
Now in the method checkDelete, when I try to retrieve the data of the entity to be deleted using READ ENTITY with keys it returns nothing as if the entity has already been deleted.
My question is what's the point of giving the possibility to perform a validation on delete action if we cannot access the entity data in the validation handler method and how could I implement my check.
I'm new in RAP so I'm maybe missing something here
Thank you for your help
Mourad
Request clarification before answering.
Hi Mourad,
I think in this case it is easier to use instance feature control, e.g.:
delete (features: instance);This way you can enable/disable the delete option under certain conditions.
If this is not suiting your requirements, an alternative would be to do a select on your entity within the validation handler method to obtain the entity data.
I hope one of these options will help you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi anoukvandenengel,
Thank you for the reply. I actually implemented the requirement using the precheck syntax :
delete (precheck);
The logic is then implemented in the method precheck_delete( ) where I have access to the instance to be deleted as at this point the modification didn't reach the transnational buffer yet.
But your solution with feature control is also acceptable 🙂
Regards,
Mourad
| User | Count |
|---|---|
| 17 | |
| 8 | |
| 8 | |
| 6 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.