Toggling custom states

I have a list of things, one of the headers for this list is ‘Price’ - I want to be able to click this header and the list order by price low to high using a custom state, but I also want to be able to click this header again to order by price high to low.

Does anyone know how to ‘toggle’ custom states?

1 Like

Hi, hopefully you saw this by now… just use the “is no” when setting your state boolean value and the value will be toggled (yes to no; and no to yes)

Hi @mlewis2016

I’am trying to implement soft delete in my users, so in my root panel i put a icon button to toggle the deleted? state. Then every time that i push the button in my panel, the state of the user change.

For the workflow works like toggle button i try to send the current state of the user in his slug.

Try this:

1° Set the user slug with the current state(custom state)
2° Test the custom state, if this condition is true, do something
3° Test the slug, if the conditions is true, do something
4° Then clean the slug to prevent bugs

I hope that helps you! Sorry for my poor english xD

Please, if that a better way to do this let me know!

hey @marco.sens
a simpler way of doing this would be to have a workflow action “Make changes to thing…” where you change the “deleted” field as follow:
Delete = This user's deleted is no

This logic has the effect of always saying the opposite of its value.

1 Like