I would like to show the name of the person who deleted the gadgets in my screen

When i delete the gadgets, i would like to show the id of the gadget and also the name of the person who deleted the gadgets in my DeleteLogs screen. It show populate in the table where it shows the id of the gadgets and also the name of the person who deleted the gadgets.

Machine.oml

Hi Viknesh,

Currently you are completely delete the record therefore you cannot get the deleted record info. I suggest that you add 2 more attributes name: IsDeleted and DeletedByUserId. Then in your delete function just need to update those 2 fields.

Hope this help,

Khuong

What do you mean by the delete function? So sorry I'm new to Outsystems 

Hi Vinkesh,

Please have a look at this .oml file. I updated the code already. 

1. Updated: Gadgets entity

2. Updated: DeleteProduct action in Logic tab

3. Updated: DeleteLogs screen.

Hope this help,

Khuong

Machine.oml

Thank you so much for the help brother. It's working 

Whenever you get a solution. Please mark as solved otherwise this conversation would not be helpful to others.

Hi Vinkesh,

As Khuong  said, you should not delete the record using delete entity action /SQL query,

Rather than you should have two more attribute in Entity like IsActive/IsDeleted (Boolean type: Default Value: True ) and DeleteBy ( to store UserID())

  • Once you delete the records, don't use delete action or sql query to delete the records rather just set IsActive/IsDeleted as False and DeletedBy the UserID() and update the records using UpdateEntityName Action.
  • While displaying to screen or list, just make filter IsActive/IsDeleted= True.

Now you can get the username by using UserID() from  User Entity to make join and where IsActive/IsDeleted= False


Dileep

This is correct.

There can be two approaches.

1. Soft delete 

2 Maintain history in another table for the deleted record.

PLease check the attached OML for your solution. It should work...

Machine1.oml

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