An increasingly common request on the Nintex Workflow Cloud platform is to save a form without submitting, so the form can be picked up and completed at a later time. Users want to be able to partially enter information, maybe grab a coffee or a pint and finish entering the data at their leisure. In this post, I'll walk through a workaround using variables and Nintex Task Forms that will achieve this functionality, allowing your end users to complete a form piecemeal as they see fit.
This solution will be for Nintex Workflow cloud and the workflow is available in the Nintex Process Gallery If you would like to watch a walkthrough, and see this in practice, please see the video below:
The basic components for this workflow / form will be as follows:
- A start form
- Variables for each field in the start form
- Set Variable actions for each variable (using start form data)
- A Loop
- A task with a form that mimics the start form
- Set Variable actions for each variable (using task form data)
Jumping into it, the first piece we'll need to configure will be the Workflow Start form. It doesn't matter what we configure for the initial form, as the general thoughts here can be applied across any forms you have deployed in NWC. For this example, I have a very simple event request form with some basic controls (choice, datetime, and text fields). Additionally two fields that will be critical to this functionality; A 'Submit or Save as Draft' choice control and an 'Email' control (if you are building an unauthenticated form this is a hard requirement). If 'Save as Draft' is selected, I have setup a rule to show / hide the Email field as we'll need this for the next step.
The next step is will be configuring variables within the workflow that align with each of the Start Form controls. This will allow us to carry forward any of the fields that were entered in the initial form to the ensuing task (saved draft) form. We will configure a variable for each start form control except for the email. If you would like to have different reviewers / people updating the form you could also configure this as a variable allowing for a new person to update the form with each draft.
Once the variables have been set we will configure a loop. This will allows the users to save the form as a draft as many times as they would like until all information has been submitted. This same line of thinking could be used in a state machine where we could potentially pass the information back and forth between different reviewers until the form has been completed. For the loop configuration we will use a 'Start a Loop' action with the condition that the Save or Submit variable we configured (varSubmitOrSaveAsDraft in this workflow) equals "Save as Draft".
Within the loop we will have two key action groupings: Assign a Task and Set Variables. For the task action, first and foremost we will configure task as a 'Form Based' task with the outcomes of "Submit" or "Save as Draft". This will allow the user to determine if they want to save the submission or again, finally submit. Beyond that we will need to configure the form. For the sake of continuity, I have added new controls on to the task for that mimic the look and feel of the original form that was submitted. The one piece that is different here is that I have now assigned default values to each of the controls. These default values will be the variables we set in the earlier step of this process. This allows us to set the form up with the previously entered information.
Once the form is setup to your liking and critically, the variables are set as default values for the fields. We will reset the variables to use the information that was entered in the task form. The first variable we will configure will be the varSubmitOrSaveAsDraft variable we configured as the loop condition. We will place this under the submit option for the task form and set the value to 'Submit'. What this will do is allow the user to exit the draft form review loop when they decide it is time to submit the form.
The last thing we will do is configure an action set to set the remaining variables from the form with the new task form values. To do this, I copied the original action set and removed the 'Set Submit or Draft' action as we are already doing that immediately following the task. For these variables, we will update the actions to use the values set in the task form. The reason for this is that we want to be able to continue to capture the latest values for each draft form. This will allow a user to set a draft in perpetuity until they feel confident in submitting.
Once everything has been configured as described above, we now have a draft form that can be saved multiple times allowing the user to simply update via their email!