I have SPD work flow which associated with a list that derived from content type. Using my .net application which was written using SharePoint Client Object Model i update .list item.But in some instances my workflow corrupted by mentioning above error.As well as my workflow has configured to initiate when list item creation only.
Finally i figure out reason for this strange behavior
There is one instance in my application in which i create list item and then updates same item to particular state.Due to these two step happen in instantly my workflow getting failed.
Solution
As solution what i have done is to make sure properly workflow initiated or not by querying the workflow instance id.Once i confirmed it then i execute rest of the code.other wise my operation is sleep till workflow initiated.From the beginning of my work flow i saved workflow instance id as list item.
As follows you can get the workflow instance id,
public string GetWorkflowURL(string styleNo, int versionId)
{
/*Getting the update list item */
ListItem listItem = GetUpdateItem(styleNo, versionId);
ListColumns listColumns = new ListColumns();
return listItem != null
? (listItem[listColumns.WorkFlow] != null
? ((FieldUrlValue) (listItem[listColumns.WorkFlow])).Url
: string.Empty)
: string.Empty;
}
This work around has worked to me.
No comments:
Post a Comment