I have created SPD workflow with a custom ASP form. My form opens when clicking on a task link and I can show information about the task. Now I want to alter the task after pressing a button, but can't make it work.

Code of my click handler:

Hashtable hashTable = new Hashtable();
hashTable["PercentComplete"] = 1;
SPWorkflowTask.AlterTask(this._taskListItem, hashTable, true);

but it seems like this approach doesn't work, I am getting the following error:

NotSupportedException. Specified method is not supported. 
at Microsoft.SharePoint.Workflow.SPWorkflowTask.SetWorkflowData(SPListItem task, Hashtable newValues, Boolean ignoreReadOnly) 
at Microsoft.SharePoint.Workflow.SPWorkflowTask.AlterTask(SPListItem task, Hashtable htData, Boolean fSynchronous) 
at NewServerForms.Layouts.NewServerForms.ApprovalTaskForm_Edit.btnSubmit_Click(Object sender, EventArgs e)

_this.taskListItem is not null (I have checked it) and was initiated as follows in the Page_Load:

this._listGuid = Request.Params["List"];
this._listItemId = Request.Params["ID"];
using (SPWeb web = SPContext.Current.Site.OpenWeb())
    this._taskList = web.Lists[new Guid(this._listGuid)];
    this._taskListItem =  this._taskList.GetItemById(Convert.ToInt32(this._listItemId));

I have two ideas, why it is hapenning:

  1. Probably I have to use another approach for SP2013 WFs.

  2. As I can see in msdn, this error could be if my content type is not derived from WorkflowTask Content Type.

Most likely it is really the latter, because my task content type looks as follow:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <ContentType ID="0x0108003365C4474CAE8C42BCE396314E88E51F00F35251B8B0C24C4986783D649A695D00" Name="TaskApproveNewServer" Group="MyGroup" Description="MyCT" Version="0" Overwrite="TRUE">
      <FieldRef ID="{6f78c128-5660-4835-9b03-4c08d5eef709}" DisplayName="AbsenceStatement_Status" Required="false" Description="" Hidden="false" Name="AbsenceStatement_Status" Sealed="false" />
      <FieldRef ID="{55B29417-1042-47F0-9DFF-CE8156667F96}" DisplayName="$Resources:_FeatureId57311b7a-9afd-4ff0-866e-9393ad6647b1,TaskOutcomeField_DisplayName;" Name="TaskOutcome" Sealed="FALSE" />
      <XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
        <FormsUrl xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">

Its ID derived from WorkflowTask, but there is no Inherits="TRUE" attribute (it was removed, because I can't use custom forms when it is true because of the well-known issue).

So, could you suggest me, how can I alter the task using my custom ASP form?

Every suggestions are very appreciated.

Kind regards, Michael

PS: This is a cross-post from Microsoft forums.

Update 1:

It seems like the cause of the issue the former. At least, now I added Inherits="TRUE" attribute (and set forms from the Feature receiver), but anyway I am getting the same error.

1 Answer 1


It seems like the SPWorkflowTask.AlterTask method really doesn't work for 2013 workflows, but we can change task fields directly and it works well.

For instance, instead of

Hashtable hashTable = new Hashtable();
hashTable["PercentComplete"] = 1;
SPWorkflowTask.AlterTask(this._taskListItem, hashTable, true);

We could write

this._taskListItem["PercentComplete"] = 1;

Don't forget to add Update.

UPDATE1: I have just written a walkthrough: how to implement custom task forms for SP2013 WFs.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.