Skip to main content
Hi,

I have created a workflow that is generated from an xml file. Each step has a list of approvers passed in. The approver type can be a user or a group of users. I wrote code that generates the destination queue perfectly. I have one last task that i can't seem to get right. I have a node in the file that is the number of approvals required for this step to complete. I have written the following code as a succeeding rule for the activity.

private bool Func1(ref SucceedingRuleContext K2) {
object firstVariable;
object secondVariable;
object LogicalData;
string exceptText = "";
int Counter = 0;

LogicalData = System.Int32.Parse(K2.ProcessInstance.DataFields["NumberApprovalsNeeded"].Value.ToString());

secondVariable = "Completed";

foreach (ActivityInstanceDestination ActInstDest in K2.ActivityInstance.Destinations)
{
firstVariable = ActInstDest.Status.ToString();
exceptText += " Value of firstVariable = " + firstVariable.ToString();
int iCom;
iCom = firstVariable.ToString().ToUpper().CompareTo(secondVariable.ToString().ToUpper());
if (iCom == 0)
Counter += 1;
}
if (Counter == Convert.ToInt32(K2.ProcessInstance.DataFields["NumberApprovalsNeeded"].Value))
{
return true; }
else
{
return false;
}


It doesn't work for any number of users greater than 1. I think it has to do with the number of slots for the activity. I cannot programmatically modify the number. Does anyone know if I am on the right track and what a possible solution may be for this problem?

Thanks,
Hi,

If I understand correctly you have a list of approvers, say 10 guys, and you would like the activity to continue when say the 5th guy approves the item.

Did you try setting 'Create a slot for each destination' on the activity. For this setting each of the 10 persons will get the item and when the 5th guys approves the item your succeeding rule code should work perfectly and continue the process and the other 5 items will be removed from the remaining 5 approvers.

Hope this helps,
Tersia
Hi Theresia,

Thanks for the reply. Creating a destination for each slot and setting a succeeding rule worked great.

Reply