SetStartRule doesnt work as expected in a process migrated from k2.net 2003

  • 4 January 2011
  • 1 reply
  • 0 views

Badge

Hi,

We have installed K2 Blackpearl and migrated data/processes from K2.net 2003 server, with the migration all the processes also got migrated to blackpearl and we are able to create instance of the same. We have a process called "Guarantee Open" which has an activity called "Owner enters GTE details" this activity has below code in its code in its Start Rule


public void Main(ref StartRuleContext K2) {

Shared.SetTaskStartRule("RG", "Owner enters GTE details",K2);

}


and below is the body of the method called above (Shared.SetTaskStartRule)

problem we are facing here after the below code is executed we are unable to locate the workflow instance itself in the system, we searched in Process | Instances, Errors, WorkList

we also tried looking in [K2Server].[dbo].[_WorklistHeader] table, after the process comes to above task the entry for workflow instance is removed from the table as well.

I am unable to trace the workflow instance anywhere in the k2 system kindly help me!!!

please note that this is an migrated process from K2.net 2003 and its running fine in K2.net 2003 version.



public static void SetTaskStartRule(string workFlowName, string workFlowTaskName, StartRuleContext K2)
{
int waitTime=0;
int result;
DateTime startRule=DateTime.Now;

switch (workFlowName)
{
//Request guarantee work flow
case "RG":
if(workFlowTaskName=="Owner enters GTE details")
{
if(int.TryParse(K2.StringTable["RG_AfterATApprovalsWait"],out result))
{
waitTime=result;
}
else
{
throw new System.Exception("Invalid entry for variable 'RG_AfterATApprovalsWait' in K2 String Table, please enter integer value and repair the error.");
}
}
else
{
throw new System.Exception("Invalid WorkFlow Task Name.");
}
break;
//confirm guarantee work flow
case "CG":

switch (workFlowTaskName)
{
case "Confirm OE GTE returned":

if(int.TryParse(K2.StringTable["CG_OE_NotifyStakeholdersNoLongerNeededWait"],out result))
{
waitTime=result;
}
else
{
throw new System.Exception("Invalid entry for variable 'CG_OE_NotifyStakeholdersNoLongerNeededWait' in K2 String Table, please enter integer value and repair the error.");
}
break;
case "Owner enters GTE details" :
if(int.TryParse(K2.StringTable["CG_CE_NotifyStakeHoldersPendingExpWait"],out result))
{
waitTime=result;
}
else
{
throw new System.Exception("Invalid entry for variable 'CG_CE_NotifyStakeHoldersPendingExpWait' in K2 String Table, please enter integer value and repair the error.");
}
break;

case "Confirm CE GTE returned":
if(int.TryParse(K2.StringTable["CG_CE_NotifyStakeHoldersPendingExpWait"],out result))
{
waitTime=result;
}
else
{
throw new System.Exception("Invalid entry for variable 'CG_CE_NotifyStakeHoldersPendingExpWait' in K2 String Table, please enter integer value and repair the error.");
}
break;

case "Confirm CE GTE Extension":
if(int.TryParse(K2.StringTable["CG_CE_IsBankOnRequestCitibankWait"],out result))
{
waitTime=result;
}
else
{
throw new System.Exception("Invalid entry for variable 'CG_CE_IsBankOnRequestCitibankWait' in K2 String Table, please enter integer value and repair the error.");
}
break;
default:
throw new System.Exception("Invalid WorkFlow Task Name.");
break;
}
break;
//Amend guarantee work flow
case "AG" :
switch (workFlowTaskName)
{

case "Confirm Expiry":
if(int.TryParse(K2.StringTable["AG_NotifyStakeHoldersToBeExpiredWait"],out result))
{
waitTime=result;
}
else
{
throw new System.Exception("Invalid entry for variable 'AG_NotifyStakeHoldersToBeExpiredWait' in K2 String Table, please enter integer value and repair the error.");
}
break;
case "Confirm Amendment":

if(int.TryParse(K2.StringTable["AG_IsBankOnRequestWait"],out result))
{
waitTime=result;
}
else
{
throw new System.Exception("Invalid entry for variable 'AG_IsBankOnRequestWait' in K2 String Table, please enter integer value and repair the error.");
}
break;
default:
throw new System.Exception("Invalid WorkFlow Task Name.");
break;

}
break;
default:
throw new System.Exception("Invalid WorkFlow Name.");
break;
}

if (K2.StringTable["Escalation_StartRuleDays(D)_Mins(M)"]=="M")
{
startRule= startRule.AddMinutes(waitTime);
}
else
{
startRule=Convert.ToDateTime(startRule.ToShortDateString()).AddDays(waitTime);
}

K2.SetStartRule(startRule);
}


Reply