Sharepoint 2013 Develop a Visual Studio 2012 Workflow

In Visual Studio 2012 you can create Sharepoint 2010 WFs or Sharepoint 2013 WFs.

Sharepoint 2013 WFs are declarative WFs, so they don’t have code associated or a dll to deploy to GAC.

In this sample, I  created a VS 2012 WF in a empty Sharepoint 2013 project, deployed as a sandbox solution.

First step is to create the project:

vswf1

Select deploy as a sandbox solution:

vswf2

After your project is created, select Add a New Item and choose Workflow:

vswf3

At this point you can choose between a List or a Site Workflow. Site Workflows, were introduced in Sharepoint 2010, and they run at the Site level.

In this sample I choose to use a List Workflow:

vswf4

In the next step I selected the Document list, this is the list, where the Workflow will be available:

vswf5

In the next step I choose to create a new task and history lists:

vswf6

The last step, is to select the startup type, for your Workflow, it can be manual, On Item Added and On Item Updated.

After this step you can start creating your Workflow:

vswf8

In the Toolbox, you can see the activities that you can use in your Workflow, you just need to drag them to your WF design.

If you explorer your solution, you can see that you have a feature to create a history list and a task list to your Workflow.

My Workflow starts writing to history list “WFStarted”.

Next I Create the tasks to get the user name that created the current item.

First you need the “LookupSPListItem” activity to get the ListItem properties.

Next “GetDynamicValueProperties” to get the ListItem AuthorID to a WF Variable:

wf12

Next you need the “LookupSPUser” to get the User properties for the AuthorId:

wf13

And another “GetDynamicValueProperties” to get the LoginName, to a Workflow Variable.

wf15

And finally the task that writes to history list the message “WFSample End Author:” + username

wf14

The all  Workflow  is:

wf16

After deploy the solution, the Workflow will run in Documents list:

wf17

Advertisements

Tags: ,

4 responses to “Sharepoint 2013 Develop a Visual Studio 2012 Workflow”

  1. cyberpine says :

    Excellent – Thank You! I’ve subscribed.

    1. Can a vs2012/WF2013 like this be deployed on SharePoint Online 2013?
    2. Does WF 2013 offer me more options for example, can I change item/file permission on Library Document?
    3. What do I need installed with VS 2012? Do I need SP 2013 installed on the same Dev server? where does WorkFlow Manager 1.0 fit into this if anywhere?

    Here’s what I’m really trying to do on SPO..

    http://social.technet.microsoft.com/Forums/en-US/onlineservicessharepoint/thread/cc4d57bb-867d-4acf-a88c-39d0fa9b9784

    http://sharepoint.stackexchange.com/questions/69329/sharepoint-online-2013-workflow-to-change-file-permission-in-document-library

    Thanks for any information on this!

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 )

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: