Reset/Clear a Custom state value

How do you clear a custom state (text value)? I am using a button to trigger a custom state value that shows a group in a groupfocus. Problem is that once the group is hidden, if I click the button again, it doesn’t show the group. I believe it’s because the custom state hasn’t been cleared. Is it possible to have the custom state cleared after re-clicking the button?

Assume you have a custom state on a group (“X”), called ‘visible’ with the type yes/no .

The easiest way is to setup an action to “set state of an X to” and then for the state itself say (X’s visible “is no”)

what this does is check if the current state is “no” if the current state is “yes” - meaning that your element is visible through a condition you managed - the answer to this question is “no” meaning that this will become the new state, and as a consequence will hide your element.

The opposite is true as well. If your current condition is “no” (meaning the element is not visible) the answer to the question (is it no?) is yes, setting the state back to yes.

This is the most effective way (in my opinion) to manage state’s via one single button and one single workflow.

Hope this helps!

So should the visibilty of the group be yes or no?

It depends on the action triggered by your button.

Above an example of how you could do it (with the button being the thing having the state on it). Always make sure that the check on the state is: “is no” so you will effectively create a toggle for the group based on someone clicking a button.

Okay, I just implemented what you just told me. It doesn’t work how I want it to. Your method, requires me to click the button twice (after the first click) to see the group. I need a better option, or am i doing it wrong?

Is it supposed to take two clicks? Or am I implementing it wrong?

Try using a Custom Event that resets the custom state and is triggered by a “When custom state is not empty” condition.

Have you tried setting the state value to a blank?

I will give this option a try, thanks.

1 Like