I’d find it helpful if there were a way to trigger workflows when a custom state changes. Right now, there’s a way to do similar when the value of an input field changes and it’d be useful if this were extended a bit.
I use set states triggered by workflows all the time. Just do a “when something is true” which is when the set state is set to something. I think I explain this in my video if you want to take a look. I can’t remember if I specifically do this or now. I know for sure in a menu, but I know this is possible now. Maybe not before, but it is now.
On further thought, although the code works, couldn’t you just do the workflow after setting the state or create a custom event to set the state and trigger the workflow? I think it might be easier than using the code. I use the code for manually changing an input’s value.
I think one of the challenges is when you are using reusable elements. For example, I have a scheduling app that uses a calendar saved as an RE. When the date in the calendar changes, I want the date in the “confirm appointment” box to change as well.
I know this thread’s a bit old, but I just discovered it via this other thread. I think @J805’s response is on the right track, but in my experience, in order to detect change, both the previous and current value need to be stored so that a comparison can be made (which is a bit different from just detecting when a state changes from empty to some value).
Anyway, it’s actually quite straightforward to do, as I outline in this post.
@willtaylordesign, in the case of reusables, custom states defined at the root level are accessible to the host page, so I don’t see why a similar approach wouldn’t work for that scenario.
Hmm, I’d probably need to see an example. If I understand correctly, I’m doing just that with my own RE time picker. Here, I’m just toggling the visibility of a shape whenever the selected_date custom state of the RE changes…