149
Views
4
Comments
Solved
Soft Delete (From user view point)

I am trying to delete specific data (using the button delete) from the table but when I implemented the delete it deletes the data from the database too. I need to store the data but from only the client page it will be deleted. (I want to implement soft delete)

2023-10-21 19-42-11
Tousif Khan
Champion
Solution

Hello

For this use case you can create a Attribute into your database table (entity) like

To do a soft delete you can add an attribute to an entity called "isDeleted" or "isActive" (or anything you'd like , Then in you aggregates in your application you filter out all of the isDeleted ones. 

IsDeleted" or "IsActive" (or anything you'd like)  with data type Boolean, and set the default value to true so whenever  you create a data it will save IsActive as true.

and when you delete the  data you don't need to use delete entity action. on the delete button  you update that attribute for the record you want to soft delete. 

  • Ex :

           IsActive = false

And where ever you are showing your data from the aggregate just use the filter on that aggregate as

  • Ex:

          Employee.IsActive = True

Only data which is true will be fetched and shown on your client side

meanwhile in your DB all the data will be stored.

I am also attaching Sample Oml

Sample - 

https://personal-wwkmlamd.outsystemscloud.com/DemoApplication/Employees

Hope this helps

Best Regards

Tousif Khan

DemoApplication_SoftDelete_Sample.oml
UserImage.jpg
MD MOSHAROF AL AHSAN

Hello. Thank you so much for your explanation. It works properly.

2026-03-12 06-20-48
KUNDAN CHAUHAN
Champion

Hi Mosharof ,

There are many threads about this subject, 

I share a link one of them.  try to see  answer to see the next steps you should take :)

https://www.outsystems.com/forums/discussion/75330/soft-delete/

Thanks

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi,

When you defined the IsActive attribute you can also set it on the Entity definition, which will then ensure that on any aggregate you create the filter on the IsActive = True is added by default:
https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Data/Modeling_Data/Entity


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.