262
Views
6
Comments
Connect delete button with crud operation

Hi!

I'm very new to OutSystems so please keep that in mind if I'm not making 100% sense. If I miss any details of importance just let me know and I'll add more information to solve this problem I have.


So the scope is I am listing some "items" from an entity. The deal is that I wanted to be able to make it checkable. After som research I found out the best way was to make a structure containing a boolean and add it to an aggregate to select items in the list. Said and done I got it to work really good. 


What I want to do next is to add a "remove" button. But I just can't seem to get it to work. This is the first time I am using a checkable with a structure. I've previously done delete crud operations. When I add the delete crud inside of the delete action I can't locate or use "AggregatenameId.List.Current.Comment.Id" since it's a structure? 


What am I missing? 


Thank you in advance.


Best regards, Steven

OutSystems Padawan


2021-06-02 20-50-04
Márcio Carvalho

Can you share an OML or some screenshots? It would be very valuable to see what is really happening.

You just need to pass the id of the current record of the entity that you are listing when you click on the record obviously. After that, you can use that id to use the delete action and delete the record. Dont forget to refresh the table.

Did you try to debug if you were passing the right id?

Did you try to see if you deleted it?

2022-10-17 18-34-06
Steven Erixon

Thank you for the quick reply.


This is the client action (DeleteOnClick) with the server action(DeleteBestPracticeId). How I've done it previously was to pick "AggregatenameId.List.Current.Comment.Id". 

I think the problem is I can't wrap my head around with how a structure works.

2021-06-02 20-50-04
Márcio Carvalho

When you use structures, you are always sending everything inside of a structure, of course, you can use a structure to put inside of action, but it's better to pass the id of the entity that you are trying to delete. So in this case, I would look for a data type of the entity(identifier) you want to delete.

Structures can have multiple uses, but for delete, you are just going to need an identifier, there are some cases that you need to send a structure where you will need to use more data besides the identifier, but I think in this case you don't need to send a structure just for deleting.

"A Structure is a compound data type used to encapsulate groups of related attributes." , i.e, when you want to "mix" attributes to build costume attributes like for example calculations, boolean attributes to say that something can be shown or not, etc you will use a structure to return or to get that logic.

Have a look at this document about structures and this too.

Regards,

Márcio

2021-09-06 15-09-53
Dorine Boudry
 
MVP

Hi Steven,

Can you show the aggregate details that retrieves this list.  As part of the output of that, you will obviously have to have any id that you later will need for the delete action.

It now looks to me from your screenshot, that there are only 3 attributes in it, BestPracticeName, ProjectId and Checked.  

Dorine

2023-03-16 16-29-51
Paulo Rosário

Hello Steven , 

If your GetBestPraticesCheckTable already returns the information you need that aggregate does not need to be used.

You can use the output of that action to populate your check table and then use only that structure on your DeleteOnClick Action.

Make sure you add the new field to your aggregate inside the GetBestPraticesCheckTable action.


Hope it helps!

2018-12-26 07-13-49
Tarun Verma

you can get some concepts about CRUD from here https://youtu.be/HJB9k7FPeEM and https://youtu.be/uP9vJVH8PsY

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