Sharepoint 2013 Custom Workflow Activity SingleTask with Custom Content Type

In this post I’ll talk about how to develop a custom Workflow Activity that creates a SingleTask, with a custom Content Type,  collect data from user and update the target list item with that data.

This post is a sequence from (, where I explain in more detail the steps to create a custom Workflow Activity.

I started creating a SharePoint 2013 Empty Project, deployed as a sandbox solution.

I added a new item of type “Content Type”:


Then I followed the wizard to configure my new Content Type, selected to inherit from item:


Defined my new content type columns:


And the basic settings:


Then I added a new item to my project, of type “Workflow Custom Activity”, and added the actions to have the logic I needed:


The first actions in my Activity are to get the username of the current’s item author. I used that username in my SingleTask action, in the “Assigned to” field.


After that I started configuring my Single Task action.

Since I wanted to use a custom Content Type, I started to get my content’s type id. I got that from my content’s type elements.xml file:


Then I configured my Single Task as in the next picture:


In the next actions I did the logic to get the value of the Category field from my Workfflow Single Task, and add that field’s  value to the field Category in my target workflow item.

The fisrt step was to get the TaskListId:


Next I got the Task Item from the Task List, using the taskId, returned in my Single Task action:


Then I got the value of Category field from the TaskItem:


And finally I updated my Workflow target list item with that value:


I created a SharePoint Designer Workflow that calls my new Activity:


Run my Workflow, and saw my task with my new Content Type (I had to configure my Task List to support this Content Type, in List Settings. This is possible to be done automatically by code):


Completed my Workflow:


And saw my Item with the value collected from my task:


Tags: , , ,

Leave a Reply

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

You are commenting using your 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: