Forum Academy Marketplace Showcase Pricing Features

Idea: Enable triggering workflows based on a change to a custom states' value

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.

Would this be helpful for anyone else?

12 Likes

Hey What is this workaround? I am currently trying to figure this one out myself!

You can probably just put an input on the page. Set it’s value to be equal to the value of the custom state. Then, trigger a workflow when the input’s value changes.

[edit 1: syntax change]
[edit 2: adding link to app]

Okay, I am not sure how to set the input value to equal the state of another element. When I go into my input and type something in, it is working.

Input

After reading the manual and trying a number of different ways I am not sure this approach is possible.

An input’s value is changed

This event is triggered when the value of an input changes. For text inputs, the event is triggered when the user removes focus from the input.

1 Like

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.

It would be a nice feature, so that we could spot a “generic” changes of a custom state, and not having to specify the new state value to do something.

You can use a bit of code to do this. I set up a test app. You need to put the input in a group and reset the group after you execute the code.
The code is

var element = document.getElementById('inputToTriggerUpdate');
var event = new Event('change');
element.dispatchEvent(event);

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.