Disable buttons in a filtered collection based on conditions

Hello,

Back with another question :grinning:

I have a collection that is shown on the layout based on a couple of conditions. Each line item will have an action button (eg., Send Email). An end user can pick and choose whom to send email. Once if they click on a line item they should be unable to click on send email in the other rows.

This is because along with an email it will also create an invoice in the action. If it is one row, I can apply custom CSS and show a grayed out button.

Since these are multiple rows, how can I change the label of other buttons in this filtered collection and gray them out?

The only way I see out here is to take the filtered collection as a JSON object, send it to zapier and change the status of a particular column, based on which I can modify the label. But graying out a column without any action on an individual line item, I’m yet to figure out.

Any pointers for me? I’m sure there should be better approaches than what I suggest :face_in_clouds:

Thank you!

First thing that jumps into my head:

  • When the first item is actioned, set a boolean column to true
  • Do a rollup through a query on the filtered collection, counting true values
  • Only allow the action if the query is empty.
1 Like

Just for me to be clear, when say you say rollup through a query, does it mean I need to create a column in the respective table where I write the query you explained?

Yes, you need to be able to access it for the purpose of setting conditions on your collection actions. So it could either be in the same table, or in your User Profile table.

Actually, just thinking about it, you don’t even need the rollup column. You can just set a filter on the Query “where column X is checked”, then use the state of the query (empty/not empty) as a condition.

1 Like

Alright, let me give it a try!