Does anyone know how to change Ionic toggle value in workflow?
I have tried “set state” and does not work.
Here is my try.
I tried changing toggle B value following as toggle A value and failed.
Use the conditional Workflows on your main workflow. The ionic toggle has this feature built in btw. Just use autobind.
Do you mean to say I should use database?
Depends on what you want to do. If you want to do it like the example above, create two different Workflows with conditional statements.
Hi @kouheiimazu, keep in mind the Ionic toggle is itself a boolean. It is always in a state of either true or false. (i.e. “is checked” or “is not checked”)
If you are simply wanting to toggle B according to A, you can reference the element itself like this:
By using “is checked” we are creating a parallel boolean state in Toggle B. If Ionic Toggle A is checked, then the condition is true. If it is not checked, the condition is false.
Here it is in action:
If you want to do it in a workflow, set up a yes/no state like you did. I’ve essentially duplicated how your state was set.
Make sure the preset status on Toggle B is Dynamic and the Dynamic status references the yes/no state you set up.
Now, let’s simplify your workflow a bit. Use the same An input value is changed trigger but instead of creating conditionals to set the state to yes or no, simply reference whether Ionic Toggle A is checked or not.
That will create the same result as referencing Toggle A state directly from Toggle B but using workflows instead.
Here is the result:
Maybe that helps Good luck!
Hi, Thank you for your solution!
May I ask one more question?
I want make the toggle off from button/text click.
So I am using workflow with set state following you.
It works but works just “Once”.
Do you know how to make it change every time?
When you “manually” change IonicToggleA (to on from off in your screenshot…after you pressed the button), you would need another workflow to “update” custom state castam to “yes”.
As it stands now, on page load castam is set to yes by default. When you click the button, your workflow changes castam to “no”. There is nothing that changes castam back to yes, so it only (correctly) works the one time you told it to.
Use only when… in conditional statement on the workflow. You will need two seperate workflows.
Thank you for your reply.
I have just made 2 workflow for set statement.
But it still does not running.
Is something mistake available in the workflow?
Turn them around. When this isnt checked set state to yes. Something it’s good to take a small break and read what’s happening.
Right now you have when ionic checked (yes) > set state to yes… it should be no.
What do you want to achieve here? The workflow setup is correct but right now you have another issue.
It’s like you’re saying when the door is locked and the door is unlocked, unlock the door. Doesn’t have any added value.
You can not unlock a door that’s already unlocked.
I want make the toggle off from button/text click everytime.
Do you know how set up is correct?
Okay, so the answers above from @nocodeventure & @meyerhd2 are partially correct, you do need to reset the state for it to work, but that is only part of the issue. As you can see here, I have both the button and the toggle flipping the custom state back and forth but as soon as I use the toggle, it no longer works dynamically and only changes upon manual input
The real issue is that when you use the toggle manually it’s PRESET STATUS is overridden. Fortunately, it’s an easy fix
Right-click on the toggle and click Group elements in a Group
An empty group is fine, no need to set content
In your workflow, simply add a step to reset the group containing the toggle before changing the custom state’s value. This will reset the toggle to it’s preset status and make it dynamic again.
There you go. Working perfectly!
YES! It works!
Thank you very much for your solution!
Thanks very much, I just used this reset data solution!
This topic was automatically closed after 70 days. New replies are no longer allowed.