Skip to main content

Greetings,


I wanted to create a workflow that ran when a box was checked in SharePoint. So I started with the initial "run when item updated" SharePoint event integration.


While I could simply put a rule on the start line, I figured this would mess up the statistical reporting on the process. The documents in question would be modified a lot before needing the workflow to run. So there would be lots of instances that would start, but not run down the initial line.


So instead I dropped into code and added a couple of lines to the Start Rule of the entire process.


SPDocItem is what I named my Metadata Field in the SPEvents wizard. Then the XPath I traced from the Object Browser.


  try
{
string strXML = K2.ProcessInstance.XmlFieldsd"SPDocItem"].Value;
string strXPath = "MetaData/Items/Item/ReadyForReview";
string strValue = SourceCode.Workflow.Common.XmlHelper.GetXPathValue(strXML, strXPath);


if (strValue == "True")
{
// Document is ready to review.
}


 else
{
K2.Start = false;
K2.Message = "Document not ready for review yet.";
}
}
 catch (Exception Ex)
{
K2.Start = false;
K2.Message = "Error in Start Rule. Go to Code." + Ex.Message;
}


------------------------------


If any K2 developers/product managers are looking for an idea, it would be nice to have a wizard for the process start rule that could do some simple comparisons like this.

Great feedback, thanks for posting.  You can also give direct feedback via the K2 portal here https://portal.k2.com/feedback/Default.aspx This way its gets better tracked.


 


Thanks again


Reply