I am trying to send the item back to auther in workflow using coresrvice, the below is my code, am getting compile error on casting betweento usrdata to linktotrusteedata.
WorkItemData workitem = (WorkItemData)csClient.Read(workitemid, readoption);
ProcessInstanceData processInstance = (ProcessInstanceData)csClient.Read(workitem.Process.IdRef, readoption);
IEnumerable<ActivityData> ieActivities = processInstance.Activities;
if (ieActivities != null)
{
ActivityInstanceData targetactivity = (ActivityInstanceData)csClient.Read(processInstance.Activities[0].Id, readoption);
UserData lastperformer = (UserData)csClient.Read(processInstance.Activities[0].Owner.IdRef, readoption);
ActivityFinishData finishData = new ActivityFinishData();
finishData.Message = "Finished automatically";
finishData.NextAssignee = lastperformer;
csClient.FinishActivity(targetactivity.Id, finishData, readoption);
csClient.Close();
}
You have the LinkToUserData
object already, so can't you assign processInstance.Activities[0].Owner
to finishData.NextAssignee
, or use the Owner
property (LinkToUserData
) to construct a new data object?
Or is there a specific reason you read the UserData
?