Article: AN0001926Updated:
If the workflow was executed for a particular record, then it is also possible to cancel this workflow according to this record.
Below script cancels all workflow instances, that are running for the given record.
var dr = ...determine datarow...;
var wfRunList = OG.WorkflowSeq.GetRunsByDataRow(dr, true);
if ( wfRunList != null && wfRunList.Count > 0)
{
OG.WorkflowSeq.Cancel(wfRunList);
}