This document describes how to add a button to delegate a task within an InfoPath form. It is a direct continuation of the example provided within the Nintex Workflow 2010 SDK (InfoPath integration).
Open an InfoPath form. Three additions were made to the form before adding the ‘DelegateTask’ data connection.
A button was added named Delegate, as well as a text field named ‘delegateuser’ and a yes/no boolean checkbox named ‘SendNotification’.
These can be added anywhere on the form design.
How configure a Delegate button
Add another SOAP Web Service data connection from the Data tab in the InfoPath Ribbon. Use the Nintex Workflow web service URL used previously (<site url>/_vti_bin/nintexworkflow/workflow.asmx).
Choose DelegateTask as the web service method.
In the parameters screen, set the value for taskListName to the name of the task list on the SharePoint site that the workflow will use.
Complete the wizard, and uncheck the Automatically retrieve data when form is opened option.
Open the rules for the delegate button. Add an action to set the 'spTaskId' query field of the 'DelegateTask' web service to the SharePointTaskId field of the first 'UserTask' node in the 'GetRunningWorkflowTasksForCurrentUser' data set.
Add another action to set the 'targetUsername' query field of the 'DelegateTask' web service to the 'delegateuser’ field from the InfoPath form.
Please note: The ‘delegateuser’ field should contain the account name of the user to whom the task will be delegated.
Add another action to set the 'comments' query field of the 'DelegateTask' web service to the value ‘delegate test’ (this can be altered in a real working scenario to a form field).
Add another action to query the 'DelegateTask' data source.
Add a final action to close the form. The final rule set should look like the following:
Save and publish the form.
Please see the attached simple form which queries for the current task associated to the InfoPath form, and then allows the user to delegate the task via the Delegate button. This form contains a section that shows the details of the queried task as well as a button to perform the query. Data connections in this example will need to be edited to match the correct URL for your environment.