Friday, April 13, 2012

Custom Task form in workflow


In workflow we many times have a requirement to create custom task form four our business logic. Yes you must be telling that it was possible through creating custom content type which inherits from task content type and then associate that with workflow in an workflow xml file.

All true, but with SharePoint 2010 designer now we also can customize task form for any of the workflow.

We are going to see how we can customize it and also we are going to see what new actions are available for that process.

I have one list called Orders and we are going to associate a workflow and then in that we are going to have custom task form. So open SPD 2010, connect with the site and then go to workflow.

Create a workflow and attach it with a list called “Orders”. In your case it may be a different list than me.

Now we are going to add an action called start approval process.


Click on the first parameter in the action that we need to configure.



This allows us to configure the entire task handling process the way we want. Here we can handle when the task end, overall behavior of task process, individual should task item process etc.



As you can see you can also configure reassignments, change requests are allowed in the task or not.

If you look at the right panel in task editor, you will find fields. I have already added three fields to it just for a demonstration purpose. Do not go on the logic. But it will serve the purpose of customizing the task form.

Go ahead and add some fields to it. These fields will appear on the task form. You can also choose the existing field.



If you look at change the completion condition, change behavior of individual task and change overall task process closely, you will find a lot of conditions and actions inside them. This is the pre-built logic that follows approval process.

If you wish to make changes to any of these, feel free to do that and see how your workflow goes according to the change that you make.

I am going to add some logic to each task. We can add logic when task it created, expires, Pending, deleted or even completes.



You can also change the overall task process. For example, if in your requirement you have five approvers and if three out of five approves then you do not want to waste your time with two more approvers to approve or reject. You simply want to approve the item as majority of them have approved it. In this scenario, you can use overall task process.

If you go back to the workflow settings to edit the workflow, (one level above task editing page) where we had added start approval process on this item with approver.

Click on approver.



Here you can select any individual, active directory DL or SharePoint group or even field from the list or library.

You can also define to start the process as a sequence or in a parallel.




















Let’s publish the workflow and then test the workflow. Make sure that you have selected start workflow when new item is added option from workflow settings page.

I’ve added an item to orders list and workflow has now started as you can see the status in in progress.



If I now open the task allocated to me, I would see three more fields in the task form.



Once you are done with all the task items, you will see outcome that is again governed by the workflow logic.



You can also customize the way task form looks like. Open the Approval Task Form.



You should have the InfoPath to perform the modification in a form.

Save it and publish it. Advantage it you are customizing task form only for your custom workflow and not globally.

Now then we have modified the workflow, let’s go ahead and add one more item in orders list to see this change.




If you would like to make any change in your conditions inside workflow, you can also get these additional fields that you’ve added on the form. We have external participant and reason in the list.



I hope you have liked this post. Do try different actions and conditions. Try out customizing task process, outcome. Let us know if you face any difficulty or query and I would be more than happy to answer them if I can. J

2 comments:

Sudheer said...

i am not able to see fields on task form like hardware,software etc though they have available in the list

SharePoint Kings said...

Hi Sudheer, are you missing any steps? are you not getting only this two fields or all custom fields?

can you try to create some more field ans see?




Share your SharePoint Experiences with us...
As good as the SharePointKings is, we want to make it even better. One of our most valuable sources of input for our Blog Posts comes from ever enthusiastic Visitors/Readers. We welcome every Visitor/Reader to contribute their experiences with SharePoint. It may be in the form of a code stub, snippet, any tips and trick or any crazy thing you have tried with SharePoint.
Send your Articles to sharepointkings@gmail.com with your Profile Summary. We will Post them. The idea is to act as a bridge between you Readers!!!

If anyone would like to have their advertisement posted on this blog, please send us the requirement details to sharepointkings@gmail.com