How to keep moving a workflow on clicking of a button in a list form other than submitting a task form.

This is interesting that in our current project we were trying to implement such a mechanism by which a NINTEX workflow can be move forward on clicking a button in the NINTEX list Form instead of submitting the task form explicitly. Basically when we associate a component like ‘Start a task process’ or ‘Assign a Task’ with a list workflow attached with a task list, a new content type is added to that task list. For a complex workflow you can find out that multiple NINTEX content types are added in the SharePoint Task list. So in this case without submitting the task form you need to explicitly update that Task item field attach to that NINTEX content type inside that task list. For this you need to get hold of the task id and the respective field attach for that NINTEX content type. And then update the field of that task item inside that task list by CAML query. Remember since list is proprietary of SharePoint, either you have to update it by REST API or CAML query.

Implementation Details:

The way we have implemented are as follows:

Step 1:

When you attach NINTEX task/form in your list workflow and if you go the task list you will find a new Content type is added to the task list as follows:

Step 2:

Due to the inclusion of this content type a choice type field is added, that need to be updated to move the workflow to the next level as follows:

Step 3:

Now inside the task list if you view the items you can see all the fields but our focus will be to track the corresponding task item id and to update the choice field that get attached to the list for new content type inclusion to move the workflow further. We also need to update the Task Status as well:

Step 4:

To update the Corresponding Nintex choice field for the task list we now need to get hold of the internal name of that field. There are lot of free tools to get the internal name of a field but the easiest way to find out is to hover the mouse on that field and the internal name will be displayed below as follows:

So here in our case we can see that the choice field ‘Nintex Task Outcomes 07903077-f92e-4183-a232-bb565439eff6’ has an internal name ‘Nintex_x0020_Task_x0020_Outcomes1’

Step 5:

Now the final stage is to get hold of that task id and to update the choice field and the ‘Task Status’ field by asynchronous query using CAML. It looks as follows:

Conclusion: In this Blog/Tech Talk I have tried to show how to move a workflow to a next stage without popping/filling up the task form. We have seen how to attach a custom code that execute on clicking a button inside a list form which update a task list item using CAML query by an asynchronous call to move the workflow to a next stage. Hope you have enjoyed the blog. Lot of interesting blogs will come up in coming days. Please stay tuned and keep following our Netwoven Blogs and Webinars on NINTEX.