Resetting a State to "null"

I have a condition on a search that is optional. Essentially a list of categories that you can select one of, that filters a list. You can reset the filter by selecting the selected category, so it is back to how it it when it loads (all categories).

Is there any way to reset a Custom State ? What I have done is create an field on User that is an empty category, and the set the state to this.

Which works…but maybe another one for “the list” :smile:

1 Like

The set state action should let you have an empty value no? I think that would do it.

No, I tried that. It will allow an empty value, but doesn’t reset the state. I pulled the state out onto the page to see it working and it remained the same.

1 Like

I’m not sure I’m following then, What do you mean by reset?

Sorry, by “reset” I mean set the state to null.

If you leave the Value field in the Set State action blank, it doesn’t change the state to null, it stays as it was.

Not a huge problem, as can create some nulls on the User and use them. But maybe not working as intended, happy to send an email to support if required.

Nigel.

Just pushed a fix

1 Like

Which works perfectly. Thanks !

1 Like

I don’t see the option for setting a state to empty. Does it matter what the type of the state is? In my case it is an option set.

1 Like

did they reverse this? I can’t seem to set a state to null

1 Like

You can use the workflow “Set state” and then select the state and leave the field empty. This way the state will be emptied.

not if there is a default state unfortunately

You can set the default value of the state on page load (or with any other condition), thus leaving the default value field empty. That way you can work with it the way described above. :+1:t2: