Sunday, May 30, 2010

Microsoft.SharePoint.SPListItem.PrepareItemForUpdate + SPWorkflowTask.AlterTask + Task not updated

Hi Guys,

Today I have tried to updated task list item in workflow but everytime i was getting Microsoft.SharePoint.SPListItem.PrepareItemForUpdate error when updated item.

I have used taskcontenttype for aspx task form in my workflow. I have updated task using SPWorkflowTask.AlterTask but not solved my problem.

Solution :

Put FieldRefs in contentType XML.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ContentType ID="0x01080100DB4541EA29924902A6635A9D335C698B"
Name="SOP Issue WF Content Type1"
Group="SOP Issue"
Description="SOP Issue WF Content Type Task"
Version="0"
Hidden="FALSE">
<FieldRefs>

</FieldRefs>
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
<FormUrls xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
<New>_layouts/SOPIssueWF/Task1EditForm.aspx</New>
<Display>_layouts/SOPIssueWF/Task1EditForm.aspx</Display>
<Edit>_layouts/SOPIssueWF/Task1EditForm.aspx</Edit>
</FormUrls>
</XmlDocument>
</XmlDocuments>
</ContentType>
</Elements>