In this step by step tutorial, I will show you a way to enrich the user experience by presenting the meta data of you item (for example contract columns) in the same form as your task. So the user doesn’t need to have an extra click to see that information and all the required information are available in a single task page.
In a series of posts, I am describing the different features of Custom Task Process in Microsoft SharePoint designer. You can see a list of link to all posts here.
It is better you first create the simple working example of Custom Task Process in SharePoint designer and then you can check other posts that you are interested in.
As you see when you use the default task page of the SharePoint, only tasks fields will render in user interface and the user has to click on a link to redirect to the actual item and see the data. In our example which we have developed in a couple of posts, as you see we are creating a workflow for the contract approval form.
The task which is assig to the user is something like this:
Figure 1 – default task interface
And after click on the provided link, it redirects to the contract information
Figure 2 – contract information
In this post I want to introduce a technique about consolidating data from these two forms to just one form, so the user can see both data in a form and do the proper action accordingly. To develop this example, I use Microsoft SharePoint designer 2013 and SharePoint online service. I developed this example based on the SharePoint 2010 workflow engine.
First you have to identify which fields you want to show in the task form. For example, I want to show these fields:
- Contract Title
- Contract Description
- Start Date
- Report Status
You have to go to the task process configuration panel. Then you have to create those fields by clicking on Task Form Fields New Button.
Figure 3 – Task process configuration panel
You have to click on Add, then name your column and select the type of column you want to add here:
Figure 4 – add column
If you have the column already in your site, you can click on Choose Existing Fields and add it from the existing site columns
Figure 5 – add from existing site columns
Figure 6 – all column added
Because here we just want to show the data inside the task form, I select a single line of text as the column type for all of these columns
By adding these fields here, SharePoint designer will create those fields in your site too. So if you go to the site setting page and click on the Site Columns gallery, you will see them there.
Figure 7 – site column gallery
After adding all of the required columns, you have to fill them in the task process. So click on the Change the behavior of the single task link to open the panel.
Figure 8 – change the behavior of the single task
Then you have to fill these fields, every time a new task is created. We will do it here, because it is possible that in the process of the workflow, some contract fields change and we want to have the most recent one every time a new task is created.
In the before a task is assigned section, add an action for Set a task field:
Figure 9 – set a task field
Select the task field you want to fill out, for example the contract title
Figure 10 – task fields
In the Value, click on the Fx and then select current item for the data source and set field from source to Title:
Figure 11 – set values
The end result will be something like this:
Figure 12 – all values are set
At this point publish the workflow.
Then you have to modify the InfoPath form which is associated with this task.
So you have to go to the first page of the workflow in SharePoint designer and in the forms section click on the Task _xxx.xsn (the name may be different for you)
Figure 13 – task form
By clicking on the link, InfoPath designer application will automatically open up the file
Figure 14 – InfoPath
Now you can see all the new added fields automatically added to the infopath form. You can do some modification if you like, and then publish the form again by clicking on this quick publish icon at the top left.
Figure 15 – publish icon
You have to save the form somewhere in your local hard drive before publish.
Now, whenever you run the workflow, extra fields will be available in the task form.
Figure 16 – new task form