Wednesday, November 4, 2009

Nintex My Workflow Tasks webpart for InfoPath forms

There is a problem with the OOTB Nintex My Workflow Tasks webpart. In the case of InfoPath forms, the Item column of the webpart, takes me to the Workflow Tasks List where I can directly edit my tasks as Approve or Reject bypassing my custom InfoPath Task form. This can be a problem, if my InfoPath task form has some other fields, that I want users to fill or if my custom form determines my next level of workflow.

In this case, I want my workflow application users to use my custom InfoPath form as their Task form and not want users to edit tasks directly.

Solution:
I created a custom page in the /_layouts directory based on Nintex provided ApproveReject.aspx, lets name it InfoPathApproveReject.aspx and removed the Task update actions like Approve/Reject radio buttons and Comments, here I only have a read only view of the Task item.
For the webpart to redirect users from My Workflow Tasks Webpart to my custom InfoPathApproveReject.aspx page, I used the following NWAdmin command:

Command Syntax:
NWAdmin.exe -o SetTaskForm -siteUrl teamsiteurl -contentType contenttypename -taskformUrl taskformurl [-formType Edit|View|All] [-updatechildren Yes|No]

Actual Usage:
a. Download the custom InfoPathApproveReject.aspx form from here or the link given below.

b.Paste this form under the following folder: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\NINTEXWORKFLOW

c. Then run the following NWAdmin command:
NWAdmin.exe -o SetTaskForm -siteUrl "http://nintex/sites/myteamsite" -contentType "Nintex Workflow Task" -taskformUrl "/sites/myteamsite/_layouts/InfoPathApproveReject.aspx" -formType View

So now when users click on the My Workflow Tasks Item column, my custom Task form opens up in the read only mode, now they can't update the task form directly without by-passing the InfoPath Task form.

This solves my problem, but What if my Site Collection contains a Nintex workflow bound to a standard SharePoint List form and another Nintex workflow bound to a Document Library/List with InfoPath form as
Content type.

What happens in this case?
Since, I have customized my Task Form URL to InfoPathApproveReject.aspx, it would redirect my standard SharePoint List workflow users to my custom page and does not allow them to use the OOTB ApproveReject.aspx task form. The above mentioned solution created another problem, we need a more generic solution, check the workaround for this problem in my new post.

Download: Click here to download the custom InfoPathApproveReject.aspx task form.

Feel free to share your comments and ask me in case of any doubts.

I frequently blog at www.sharepointinsights.com You can also follow me on Twitter: http://twitter.com/Mehul_Bhuva

1 comment:

  1. Hi Mehul, Good stuff.
    I have a question, can this redirection be possible if user clicks on "Edit this Task" button (which can be seen on Form's ribbon) on client based Infopath form.
    Any ideas ?

    ReplyDelete