Is K2 Bug? The ProcessData filter of WorklistCriteria not work

  • 15 April 2008
  • 6 replies
  • 4 views

Badge +1

I make use of SourceCode.Workflow.Client.dll to get K2 Process Worklist. In K2 Process, I add a Process Datafield "DealerCode", and when start process, I set value for this field, then in the Worklist query function,  I want to Implement the function which filtered by ProcessData "DealerCode" to get the disired WorklistItem. But even the matching WorklistItem is exist, the returned Worklist is alway null.  So I worry about if it's a K2 bug.


 The sample code show in below:


WorklistCriteria crit = new WorklistCriteria();


//dealerCode is the function parameter
crit.AddFilterField(WCLogical.And,WCField.ProcessData,"DealerCode",WCCompare.Equal,dealerCode);


//OpenConnection method is a wrapped method 


this.OpenConnection();
Worklist oWorkList = this.oK2Connection.OpenWorklist(crit);


....


 


6 replies

Badge +6

Hi there,


Really not sure if it will help, but have you tried doing the same but using WCLogical.Or instead of the And.. just a stab in the dark for now.


Also have you made sure that the logged on user does receive work list items when you have no worklist criteria specified? And have you checked (perhaps through the reports) that the DealerCode process data field contains the correct value at the point in the process instance?


 

Badge +1

I try using the WCLogical.Or, but still return empty. If I don't add this filter Criteria, I can get the disired worklistitem, and the ProcessDataField value is correct.


If I replaced with below:


crit.AddFilterField(WCLogical.And,WCField.ProcessData,"DealerCode",WCCompare.NotEqual,dealerCode);


then will return all the Worklistitems which include the aimed WorklistItem. So it's very strange.

Badge +4

Hi all,


The WorkListCriteria is not up to scratch at this point. Johnson, what you are trying to do with the 'WCLogical.And' is exactly the same we got. It was fixed and will be included in a fix that will be released in the near future.


Cheers,


 

Badge +1
Thanks for your testing and reply.
Badge +4

Hi I saw a KB article from K2 portal site addressing Worklist Criteria bug:


 http://kb.k2workflow.com/Articles/KB000218.aspx


There is a patch associated with it.


Please contact a local K2 consultant if you do not have accesss to the KB site.


Hope it helps.


Regards


m

Badge +3

For me this worked:


private static WorklistCriteria SetupWorkListFilter(int pageNumber)
        {
            //Add the default K2 worklist filters as per k2 webpage worklist
            WorklistCriteria k2WorkListCriteria = new SourceCode.Workflow.Client.WorklistCriteria();
            k2WorkListCriteria.Platform = "ASP";
            k2WorkListCriteria.Count = _numberOfPageItems;
            k2WorkListCriteria.StartIndex = pageNumber * _numberOfPageItems;
            k2WorkListCriteria.AddFilterField(WCField.WorklistItemStatus, WCCompare.Equal, WorklistStatus.Available);
           
            k2WorkListCriteria.AddFilterField(WCLogical.Or, WCField.WorklistItemStatus, WCCompare.Equal, WorklistStatus.Open);
            k2WorkListCriteria.AddFilterField(WCLogical.And, WCField.WorklistItemOwner, "Me", WCCompare.Equal, WCWorklistItemOwner.Me);
            k2WorkListCriteria.AddFilterField(WCLogical.Or, WCField.WorklistItemOwner, "Other", WCCompare.Equal, WCWorklistItemOwner.Other);
            k2WorkListCriteria.AddFilterField(WCLogical.And, WCField.ProcessData, "SearchFilter", WCCompare.Like, "*test7*");
           
            return k2WorkListCriteria;
        }


 


Where SearchFilter is a standard string Process DataField. I put test6test7test8 in the field and it works.


Equal also worked if I put "test6test7test8" in the value parameter.


Gabor

Reply