With the new 2013 workflows there are a few scenarios that can cause issues which may not be obvious to those coming from 2010. One such scenario is configuring list items to have Create and Edit access set to Create items and edit items that were created by the user and have a user who did not create the item initiate a 2013 workflow. By default, this will result in the workflow failing due to unauthorised access exceptions.
Lets walk through the scenario in more detail.
Start with creating a new custom list and then in SharePoint Designer, publish a simple List workflow to it.
As you can see, a very simple workflow 🙂
Configure the list to allow users to only edit items that they created.
I recently added a delegate control to a SharePoint solution. The delegate control was used to dynamically insert a custom user control into the master page. Part of the functionality of this control required the use of hidden fields.
Everything worked perfectly until I tried to add or update a workflow against a list. After clicking Next on the add workflow page, the following error was thrown:
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster
If you’re trying to update a task item that is linked to a running workflow using code similar to
public UpdateTaskItem(SPList taskList, int identifier, string newValue)
taskItem = taskList.GetItemById(identifier);
// Update task item
taskItem["fieldname"] = newValue;
and receive an error stating This task is currently locked by a running workflow and cannot be edited, a simple fix is to update the built in field WorkflowVersion to the value 1 prior to calling the Update method.
This is the second part of the custom workflow activity creation tutorial. For the first part please go here.
Now that we have a workflow activity defined, the next step is to add a new project to Visual Studio.
Create SharePoint Project
The object of this post is to provide a walkthrough on creating a custom workflow activity for SharePoint 2010 and deploying it as part of a custom sequential workflow.
Start by creating a new empty Class Library project.