I am trying to create an instance of Collect FeedBack Workflow on a word document present in one of the document libraries in my MOSS 2007 Site. Though the workflow instance is getting created successfully, It shows me the "Error occurred in Collect FeedBack" message in description and "Error Occurred" in status of the instance.
I am using below code (and association data) to create the instance of workflow programatically. Any help greatly appreciated!
SPWeb myweb = SPControl.GetContextWeb(this.Context); SPWorkflowTemplateCollection wtColl = myweb.WorkflowTemplates; SPWorkflowTemplate wt = wtColl.GetTemplateByName("Collect Feedback", myweb.Locale); SPDocumentLibrary docLib = myweb.Lists["WFDocLib"] as SPDocumentLibrary; SPListItem item = docLib.Items[1]; SPWorkflowManager mgr = mysite.WorkflowManager; StreamReader reader = null; try string xml = reader.ReadToEnd(); myweb.AllowUnsafeUpdates = true; mgr.StartWorkflow(item, assn, xml, true); item.Update();
{
reader = new StreamReader(
@"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\template\layouts\Samples\newdata.xml"
);
myweb.Update();
}
catch (Exception ex)
{
Response.Write(ex.Message); //i am not getting any error here. But the workflow instance description shows Error Occurred
}
finally
{
myweb.AllowUnsafeUpdates = false;
}
newdata.xml (Association Data I am using) --> I am suspecting the parameters i am supplying programatically in form of following XML is somewhere causing the problem or i am missing any more steps that is required which i am not sure:
Is AccountType value should be the group name of share point user that is being added as Reviewer
xml:lang="en-us">
<my:Reviewers>
<my:Person>
<my:DisplayName>MyDomain\\MyUserName</my:DisplayName>
<my:AccountId>20</my:AccountId>
<my:AccountType>CvDevelopment Members</my:AccountType>
</my:Person>
</my:Reviewers>
<my:CC>
</my:CC>
<my:DueDate xsi:nil="true"></my:DueDate>
<my:Description>some description goes here.......</my:Description>
<my:Title>Please review this document</my:Title>
<my:DefaultTaskType>0</my:DefaultTaskType>
<my:CreateTasksInSerial>false</my:CreateTasksInSerial>
<my:AllowDelegation>true</my:AllowDelegation>
<my:AllowChangeRequests>true</my:AllowChangeRequests>
<my:StopOnAnyReject xsi:nil="true"></my:StopOnAnyReject>
<my:WantedTasks xsi:nil="true"></my:WantedTasks>
<my:SetMetadataOnSuccess>false</my:SetMetadataOnSuccess>
<my:MetadataSuccessField></my:MetadataSuccessField>
<my:MetadataSuccessValue></my:MetadataSuccessValue>
<my:ApproveWhenComplete>false</my:ApproveWhenComplete>
<my:TimePerTaskVal xsi:nil="true"></my:TimePerTaskVal>
<my:TimePerTaskType xsi:nil="true"></my:TimePerTaskType>
<my:Voting>false</my:Voting>
<my:MetadataTriggerField></my:MetadataTriggerField>
<my:MetadataTriggerValue></my:MetadataTriggerValue>
<my:InitLock>false</my:InitLock>
<my:MetadataStop>false</my:MetadataStop>
<my:ItemChangeStop>false</my:ItemChangeStop>
<my:GroupTasks>false</my:GroupTasks>
</my:myFields>