Nintex Forms/Workflow – Flexi Task with a Data Entry Nintex Form
In the past, I’ve been asked for the best way to have an approval form where some more information will be required from the approver.
Rather than InfoPath (which I’ve generally had headaches with) or developing a custom form in C# to extend the Flexi Task action form, I’ve nudged people towards using the Request Data action or the Assign a ToDo Task. These two actions were specifically made to get users to fill in forms.
Well, I’m now moving away from my suggestion above and leaning towards a Nintex Forms solution.
Problem
I want to send an approval request to a user. The options they have for the approval will be Approve, Reject and More Data.
More Data will mean that they don’t approve or reject the task, but instead would like more information about something. In order for someone to provide more information, the approver needs to also fill in some details that we can then pass on to the appropriate person.
To facilitate this, first we add the 3rd outcome, “More Data” to the Flexi Task acton:
Once this is done, we can then edit the task form using Nintex Forms:
The main thing to do now, is to add some controls so that the approver has a form to fill in, as well as provide a decision on this task. As I’m interested in functionality and not asthetics at this stage, I simply put a Panel at the bottom of my form, add a label and add a Multiple Line of Text control.
I surrounded my main Panel control with a border so that it stands out for now.
I wanted to add one more feature to this. I only want a user to fill in that part of the form, if “More Data” is selected as an outcome. In order to facilitate this, you can create a Rule. This rule would be specifically for the parent panel above (that you see with border). The rule will be that this panel will be hidden, if any outcome, other than “More Data” is selected.
You may be asking, why am I comparing the Decision field to the number 3. The number 3 is the internal ID of the outcome that we have in our Flexi Task action. To confirm that value, I found that the easiest way was to query the Nintex Workflow database for the “ConfiguredOutcomes” table. You’ll see the ID there. Alternatively, you could add a Calculated Control to the form temporarily and link it to the Decision control. Then when you select the outcome, the calculated column will display the numerical ID.
At this stage, if you were to save this form, save the Flexi Task action, publish the workflow and run it, the approver will get this form and they’ll be able to fill it in.
We are missing one crucial component here. How do we read the data from this form, since the controls aren’t connected to SharePoint fields?
Reading the Control Values from Nintex Workflow
In forms like this, there is a hidden item property called “Form Data”. This is XML that you can the query using the Query XML action and pass in the appropriate XPath expression to extract the data you need.
If you’re designing a form for SharePoint List Item, the “Form Data” is a property of the current item the workflow would run on.
In our case, the “Form Data” is an item property on the Task in the Workflow Tasks list. To get at it, we need to find the ID of the task that the user just filled and then we can use the Query List action, to query for the “Form Data” property.
First, create a List Item ID variable in your Nintex Workflow and you can then use it in the Flexi Task action to store the Task ID into this variable.
The Flexi Task action can then be followed by a Query List action to query the Workflow Tasks list, for the Form Data field of the task whose ID matches the variable “listItemID”.
The result of this action is stored in a Nintex Workflow Text variable. The contents will be a bunch of XML that looks like this :
<?xml version=”1.0″ encoding=”utf-8″?>
<FormVariables>
<Version />
<TextMoreData type=”System.String”>The procurement document is missing. Please upload that the appropriate library and link it to this item</TextMoreData>
</FormVariables>
Each control that you add to your form, you will need to give it a name. For my test, I created a Multiple Lines of Text control called “TextMoreData”. You can see in the above XML that the xml node has the same name as my control.
I can therefore use an XPath expression like //TextMoreData to pull out the text and store it in a variable.
If you have more that one control in your form, you can add further XPath expressions to the Query XML action. This is a more efficient way of processing, rather than having multiple Query XML action.
Now that we have this data, you can use it as it suits your Business Requirement needs. In the workflow I was working, I’m using a State Machine so that the approval goes out. If the approver needs more information, the data they fill in is extract from the form, I jump to the next State and use that data in the Task Description and also in the email that goes out to the approver to review this item/document and they will know exactly what the original approver wanted. Once they complete this task, it jumps back to the original state and resubmits a new approval task to the approver.
Workflow Design
*** NOTE for Nintex Forms 2013 Users ***
It looks like the rule in this form needs to be tweaked. You need to compare it to a value instead of the text ‘More Data’.
To find out what that value is if your environment, you can temporarily add a Calculated Value control and configure the formula to use the Decision field. When you publish and view the form, select the ‘More Data’ option and the Calculated Value control will tell you what the ID is meant to be.
Downloads
Nintex Workflow 2010 : v2.3.8.0
Nintex Worfkflow with Nintex Form: Download Workflow