I think you’ve gotten confused from the different suggested approaches.

You need a custom state for each type of data you want to be able to delete. So for example, if I have a data type called ‘Product’ and another called ‘Order’ and I want the user to be able to delete either a product or an order from the same reusable. You need a custom state of type Product and a custom state of type Order, not custom states that are yes/no values.

When you run an action to show the popup, you will also run the action to set the state of the data type you want to delete.

Then on button click of delete button you have an action to delete a thing, one for each of the data types you want to delete. Each action has a condition for only when the custom state of the related data type is not empty.

Then you also need to use the workflow trigger when a popup is closed to set the custom state values to empty, so that every time the popup closes the custom state is removed.

So, if you have 8 data types that can be deleted, there are 8 custom states, one trigger from button click, with 8 actions to delete a thing.

Super simple to add a new data type to be deleted, just add another custom state, add another delete action. Plus you will only be charged WUs for the delete thing action.

It is a very modular approach as well since on a page like a dashboard where there may be multiple data types that can be deleted from the single page, you only need one instance of the reusable popup, which makes things much easier to maintain and debug.

Then for your text that might display something like ‘are you sure you want to delete Product ABC’ you will have a condition for each data type with the appropriate message, and use the related custom state to display details of the data type like ‘title’.

1 Like