Clubbing InfoPath Form & Nintex Approval Form

Whenever an Info Path form published to a form library has to undergo approval using Nintex, the default approval form will have options to approve/reject and provide the comments. However, not all details of the form can be seen on the same page (until it is a list item’s approval page). Only the fields promoted from the Info Path form to the library can be seen in the approval page. So here’s the reason why I’m posting this article. In my case, the customer came back to me saying why can’t they have a single form that displays the details of the library item i.e. the Info Path form along with an option to approve / reject at the bottom of the same form. So, a bit of research helped here and here’s the solution.

Step 1 – To club InfoPath Form & Approval Form, create separate views of InfoPath form

View 1 – the requestor view View 2 – the approver view that has a section consisting of a comments textbox and approve, reject buttons. Request Form (View 1)

New View

Step 2 – Create a workflow on your list, and create a flexi task for the approver.

Step 3 – Create a data connection in InfoPath form to receive data from web-service.

  • Navigate to the Data tab -> data connections -> Add -> Receive Data ->SOAP Web Service
  • Enter the location of the SOAP Web Service definition – “WebURL/_vti_bin/NintexWorkflow/Workflow.asmx
  • Select the following web method – GetRunningWorkflowTasksForListItem
  • Uncheck the checkbox to retrieve data at form load

Step 4 – Create a rule on form load

Before switching to the approver view, create a rule on your form load. Perform the following steps in that rule

  • Set field value : GetRunningWorkflowTasksForListItem -> itemId = ItemId of your record
  • Set field value : GetRunningWorkflowTasksForListItem -> Listname = Name of your list on which workflow is running
  • Query using data connection : GetRunningWorkflowTasksForListItem
  • Switch to approver view

InfoPathConnection1

This rule and web method will return the task id associated with the current list item.

Step 5 – In the approver view, assuming the below form

ApproverView

You can see, there is a section of comments and approve and reject buttons. Outcomes may be as many and may vary from application to application.

Step 6 – Create a data connection to receive data from web-service

  • Navigate to the Data tab -> data connections -> Add -> Receive Data ->SOAP Web Service
  • Enter the location of the SOAP Web Service definition – “WebURL/_vti_bin/NintexWorkflow/Workflow.asmx
  • Select the following web method – “ProcessFlexiTaskResponse2″
  • Uncheck the checkbox to retrieve data at form load

Step 7 – To complete the task from this InfoPath form, create rules for the buttons

Approve: Condition – Rule runs when button is clicked Actions

  • Set field value : ProcessFlexiTaskResponse2 -> spTaskId = SharePointTaskId (outcome of GetRunningWorkflowTasksForListItem)
  • Set field value : ProcessFlexiTaskResponse2 -> outcome = Approve
  • Set field value : ProcessFlexiTaskResponse2 -> comments = commentTxtbox
  • Set field value : ProcessFlexiTaskResponse2 -> taskListName = Workflow Tasks
  • Query using data connection : ProcessFlexiTaskResponse2
  • Close the form

InfoPathConnection2

Reject: Condition – Rule runs when button is clicked Actions

  • Set field value : ProcessFlexiTaskResponse2 -> spTaskId = SharePointTaskId (outcome of GetRunningWorkflowTasksForListItem)
  • Set field value : ProcessFlexiTaskResponse2 -> outcome = Reject
  • Set field value : ProcessFlexiTaskResponse2 -> comments = commentTxtbox
  • Set field value : ProcessFlexiTaskResponse2 -> taskListName = Workflow Tasks
  • Query using data connection : ProcessFlexiTaskResponse2
  • Close the form

This method will complete the task according to the button that an approver clicks. In the workflow, you can proceed with your actions according to the various outcomes. In addition to the method GetRunningWorkflowTasksForListItem, we also have

  • GetRunningWorkflowTasksForCurrentUserForListItem – it gives the task associated with the list item that is assigned for the currently logged in user
  • GetRunningWorkflowTasksForCurrentUser – it gives the task assigned to the current logged in user.

In a similar fashion, we have many methods which can be used as and when required, we just need to explore the correct one…

Advertisements

33 thoughts on “Clubbing InfoPath Form & Nintex Approval Form

  1. The ProcessFlexiTaskResponse2 webservice is not working with me. It return false and i am sure from the parameter i am passing to. I tried also the other webserive ProcessFlexiTaskResponse but it gives me invalid user. Do you have any idea why its doing this ?

    • Can you share the parameters that you are passing, then I shall be able to help. Also, I would like to know what action you are using to create task in Nintex. And which web method to get the task id. Is it the same set of methods as above. Are you able to get the correct task id in your Info Path form?

      • The parameter um passing is as the following (“Comment”,”Approve”, 5,”Workflow Tasks”) um sure about the parameters they are correct .And the TaskID i bounded it from GetRunningWorkflowTasksForListItem and it is correct.

        The whole scenario is exactly the same as yours. First in the Workflow i create a task by the FlexiTask and assign it to the Manager. Then i use the GetRunningWorkflowTasksForListItem service to know that the manager has a task on this item then i switch the view to the Approver view which has the Approve Reject Button with exactly the Rules you stated above. But when i Approve the Task in the form it say nothing but i traced it using Fiddler Web Debugger i saw the return from the ProcessFlexiTask2 it was invalid user.

        I also tried the other function ProcessFlexiTask and it gave me False. I dont know what to do or what is wrong from searching around i have found that it could be security issue as my sharepoint security is NTLM Security Mode.

        Your help is really appreciated.

      • Have you created any new outcome for your flexi task. Can you approve the task using the default Nintex form and then say what all outcomes it is expecting?

  2. Yes by default there are 2 outcome created approve and reject. I tried now to approve with the default nintex form and it gave me that this item is locked by another user.

    • So this means that the server is loaded at the moment. Probably you need to wait for the task to get unlocked. Or otherwise, you can create another task (run your workflow again on another item) and try checking it again.

      • The task is created about 20 hours ago. Each time i insert a new task through Flexi it says that the server is loaded. Do you know why server is loaded ?

  3. ML, the server gets loaded when there are many many activities to be performed in queue. Then the task scheduler locks the task so that it doesn’t misses out on any assigned activities.

    But this shouldn’t be for such a longer duration as you are saying. I would suggest you reboot your server and create a new task.

  4. Actually Now i have created another task and i approved it using the Nintex normal form and it is approved successfully. But the problem is that i want to approve it through the Form i have created

    • Great! Now that the server is not loaded, create another task. In your Info Path form, create fields to see if the correct task id and assignee is being captured on form load. If the task details are correctly populated, try completing the task in the same way as explained.

      I just did a small demo, and the same methods are working for me.

  5. The GetRunningWorkflowTasksForCurrentUserForListItem return Nothing . I was using before the GetRunnWorkflowTaskForCurrentUser and it also return Nothing That’s why i used the one u r using and i check if the assigned to user is the same as the current user.

    The problem is that i checked inside the Tasks List and the Task is assigned to the logged in user right now but the Service return Nothing.

  6. I’m not able to return any data from the Tasks list. I’m only able to see information from my Quality Review list. I don’t see an option to post screenshots here. Would you be available via a webex? Also, do you do any consulting/training?

  7. I can’t use the ProcessFlexiTaskResponse2 WebService from InfoPath Form – it tells me “Invalid User” – I verified the currently logged on user is loaded correctly.

    • If u are using sharepoint 2013 and calling the webservice using udcx files then you will be calling the webservice with the personation of the administration. Thats why it tells u invalid user.
      I faced this problem and what i did is to get the function of the processtask feom the dll by any reflector and inside it there will be an if condition that checks if the current user is the owner of the task . I changed the current user part with a user that i sent to it as parameter . Then i added this webservice on my sharepoint server and call it from there.

      • Thanks Michael for your response!

        Dom, I am unsure if your web service is running properly.

        In case yes, then if you are getting the correct task details using the 1st method, log that in your form.

        Then check if the current logged in user is same as that user.

        Do let me know if you are able to figure it out, else I may assist you.

  8. Quote:

    Step 4 – Create a rule on form load

    Before switching to the approver view, create a rule on your form load. Perform the following steps in that rule
    ◾Set field value : GetRunningWorkflowTasksForListItem -> itemId = ItemId of your record
    ◾Set field value : GetRunningWorkflowTasksForListItem -> Listname = Name of your list on which workflow is running
    ◾Query using data connection : GetRunningWorkflowTasksForListItem
    ◾Switch to approver view

    How do I get ‘ItemID of my record’ and ‘Name of the list on which workflow is running’? Another connection?

    Thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s