InfoPath files are stored as XML files and can therefore be modified with the Query XML and Update XML actions from Nintex Workflow.
In this example we have a form that is used as an application form for loan computers. The form contains fields like request, loan start and return dates, requestor and what items to loan. The form also has an "approved" choice field named LoanStatus, this field has three choices: Pending, Approved and Declined.
There's a rule created that sets the LoanStatus field to read-only if the field isn't blank. Because the field always contains data this field is therefor by default disabled.
The workflow that is created will check if the LoanStatus field is set to Pending otherwise the workflow will go to the end. If the status is Pending an approval request is initiated, if the form is approved this will update the LoanStatus field to Approved otherwise the field will set to Declined.
The Workflow startup options is set to Start when items are created and Start when items are modified both set to Yes.
Update XML action
Add the XPath query to the LoanStatus field via the XPath Builder or add the path via the Copy XPath option from within InfoPath. The XPath Builder function is a real nifty function to select the required fields from the current InfoPath form.
Select the Replace node contents option to replace the Pending choice in the LoanStatus field with another text, in our workflow with Approved or Declined.
Save and Publish the workflow.
When a new item is created the workflow will send request approval and will set the outcome in the form.