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.
If you’re wondering why you get (External Participant) appended to tasks created with the CreateTask and CreateTaskWithContentType workflow activities and are investigating why it appears that the person who was assigned the task is being marked as an external participant, then it may be worth making sure you didn’t do what I did….. 🙂
I was assigning the task to the person who created the document responsible for the workflow that created the task and as they were a local machine user with a profile I didn’t get why SharePoint was marking the task as an external participant.
Looking at the XML document for the task I noticed the following element: