Conditional visibility of block based on List Details value

Hey there! Is there a way to conditionally show a Block based on the value of a field in the List Details? Or is this something that has been discussed?

Example:
(On List Details, Status Field)
If Status = New → Show block #1 and hide block #2
If Status = Approved → Hide block #1 and show block #2

Currently doing something like this with custom code, but it’s a bit difficult.
I’m letting all of the blocks display on the page and then using custom code to hide them all.
Then, I’ll search for a field value, and if it contains the value I’m looking for, I would display the block again.

If anyone is doing something similar, would love to know if you have a more elegant way of doing it :slight_smile:

Hey @kqh,

Can you please share a bit detailed info about the use case? There is no such native option, but if you give details about the flow, perhaps we can think of a possible workaround to achieve the needed result.

Thanks!

I found a way to do this with custom code so we’re all set :slight_smile:

Basically, we’d render all 5 blocks, one for each of the possible statuses of a record (in list details).

Custom code will look at the value of the status field, and show the block that corresponds to the status. The other 4 blocks are hidden. Would be amazing to be able to do this natively, but this works for now!

Hey @kqh,

Thanks for sharing this :slight_smile:

Glad to hear you found a workaround :slight_smile:

How did you come up with the code / would you be able to share it? I need to do something similar for a project I’m working on.

1 Like