Passing Variables between Workflow and Custom UI
I'm creating a workflow that passes variables to a Custom UI so I can edit their values, then returns the edited values to the workflow. It worked fine until I added a scroll view to avoid getting fields cut off by the keyboard.
An excerpt of the workflow is shared (http://www.editorial-workflows.com/workflow/6136597061828608/Mj28wOSMhGw) in case anyone can help me figure out what I'm doing wrong. When run the output should match any changes made in the UI text fields (after committing the edits). Instead it returns blank values.
I will surely see if I can help. I was eventually going to try to figure this out myself, but I used workarounds.
Edit: I actually needed to go the other way (Custom UI to main workflow), but haven't figured it out yet
The help says this of the Custom UI action:
Input: Can be used to set control values in the UI’s startup workflow
Output: Set by the Output parameter
This might come in handy (whatever it means). hehe.
Here is my first test:
Edit: It looks like the issue is passing them back to the workflow (which was my initial issue). The only place they can return is to the output of the Custom UI, and from there you have to do something.
Once again I think I have it. I am saving variables declared in a Custom UI to variables in the main workflow. (this is tiring).
I really think I have it now.
Is this what you wanted?
I deleted the Set UI control value things.
You can add back the conditional actions, but using the same variable name could mess things up, because it's hard to tell whether it is using the value from the main workflow, or the value from inside the Custom UI action
I think I have solved the issue! I am working on publishing it for the public.
Here is how you can do it:
You have to create the variable in the main workflow first, then re-create (tap on the variable name section until you see the little "Variables.." menu pop up) it on the main screen of the UI and change it's value (I haven't tried this with the textfield yet)
Now, in the main workflow, you can use the value of the variable as declared in the Custom UI action as if it is in the main workflow.
(see my "Test" link for an example for now)
It seems you have to have the variables outside of the custom UI action because the main workflow only recognizes "variable names" that are in the main workflow, however, the "values" of the variables, as declared in the Custom UI action, replace the values of the variables declared in he main workflow.
The only widget that can be used as a parameter in the main view of the UI is a widget that has prefilled information, because that information is there as soon as the UI pops up. Most widgets store information after they have been edited, , and the variable in the main UI is. It updated.
Correction, I have it working now with text fields, which change the variable to its input once the changes are committed.
Here is my Public Example
Thanks! This is really helpful.
I see what you're trying to do with passing different variable names in and out, which makes sense. Setting the UI values on load is how I can see what the input variables are, which don't seem to appear in your version.
Any thoughts on how to do that?
I'm sorry, I forgot to add it back. I took it away to simplify the problem.
It's updated now
I think the issue is the way your actions for your text fields were set up.