A video would be better, but I’m not mentally in a place where i can record something, so I am going to try here.
Forms can be used by an agent, or from Node-RED
When using Node-RED you need to use these two nodes
The idea is, everything starts from the first node, and using functions nodes ( with multiple out’s ) and/or switch nodes, and “end” using the last node, that will then update the current state and status of the workflow instance.
When you add the “workflow in” node and give it a name it will add an entry under “form workflows” inside openflow. ( if you enable “web” )
When you click the workflow on the “form workflows” section of openflow, it well send a message to the “workflow in” and you can now add logic for what form to show and/or add data to the form fields. To begin with the msg.payload will be empty, so this is an indicator send the first form to the user.
When a user clicks a button on a form, you can get that by reading “submitbutton” on the msg.payload, so if you want present multiple options for the user, this is how you detect what button was pressed. ( each button name will also be present in the msg.payload as a boolean value i thing )
In the most basic form, you would simply show only one form. Something like this
In this case, the workflow would instantly get completed and show whatever is on “toms form” … ie you cannot do anything else. If we left out the form, the user would get redirected to the front page. That can be confusing, since you don’t know if the workflow did what it was suppose to, so you might add some login.
So if you add a button to the form ( like you your screenshot ) and add a switch and set status to idle at the top, and completed at the button “workflow out” node
Inside the switch we then check if the user has pressed the button.
if not, then the user just started the workflow, so we show the form and go idle ( idle=waiting for user input )
once button is pressed, we complete the workflow ( and after that you could trigger the openra robot )
using these simple building block you can create VERY complex workflows ( and if you are using assign workflow it can becomes even crazyer but lets save that for a later post or video )
For more simple flows that just need to show multiple forms, i like to have a “stage” field on the payload. This allows to for easily creating back and forward buttons in the workflow ( wizards )
You can “feed” data into the form, from node-red … if the data is already in openflow, you might also look into “form resources” in openflow. This allows you to create a “view” of data, than can then be used insert select/auto complete boxes in the form.