Setting up a complex workflow

What you'll be learning:

  • How to change the default text of the Submit button at the bottom of forms

  • How to show, hide, and configure buttons that submit or discard the data in the form

  • How to access the button that was used to submit the form in a workflow script (form.controlSubmit)

  • How to make a workflow script run on both the mobile device and the server

Rocky Jupiter is turning out to be a regular customer: the dashboard form you made for their drivers was a hit, and now they're trusting you to deliver the Mobilengine solution that guides their drivers through their complete daily routine.

You'll be laying the foundation for the trucking company's task completion workflow: the forms that the drivers have to fill in and submit at various stages of a delivery task, and the workflow scripts that process the form submissions and that keep the list of delivery tasks up to date.

The screenshot below displays the driver's Mobilengine application screen when you're done with this part of the tutorial. The dashboard form on the right is complemented by the forms for each step of the task completion process.

What the screenshot cannot show is the engine that keeps the whole setup ticking: the workflow scripts that you'll write and associate with each of the forms on the left.

The scripts will shift the status of the delivery task that the driver is working on from Assigned through Confirmed, and Loaded all the way to Completed.

When all the details are in place, you'll make the workflow scripts run not only in the Cloud, but on the user's mobile device too, for speed and the added comfort of offline availability.

Your user's dashboard form and workflow forms

Figure 130. Your user's dashboard form and workflow forms

Let's look at all three forms and the workflow scripts that they trigger in the Cloud in turn: