How can I query a list of Work Items based on Process Template...

Expand / Collapse
 
     

How can I query a list of Work Items based on Process Template Name?


The information in this article applies to:

  • AgilePoint Suite
  • AgilePoint Enterprise Manager
  • AgilePoint Envision
  • AgilePoint Developer
  • AgilePoint Server

GOAL(S)
 To query a list of work items based on Process Template Name.
  
SUMMARY
 API such as QueryWorkList and QueryWorkListEx can be used to query a list of Work Items based on the process template name even though the WF_MANUAL_WORKITEMS table does not have a column for Process Template name (which is kept in a separate table).
  
SOLUTION
 

The following is an example of query a list of work items with a specific process template name.

string where = "";

SQLExprBuilder eb = SQLExprBuilder.GetBuilder( Global.DataBaseVendor );

if( criteria.processTemplateName != null && criteria.processTemplateName.Length > 0 )

{

    // To query the work item list belong to the specified process template name

    if( where.Length > 0 ) where += " and ";

    where += eb.GetExpr("WF_PROC_DEFS.DEF_NAME", Constants.EQ, criteria.processTemplateName );

}

wks = api.QueryWorkListEx( where );

Or

public WFManualWorkItem[] GetProcessInstanceWorkItems( string ProcessInstanceID )
        {
            string _searchClause = "";

             try
            {
                if ( ProcessInstanceID.Length > 0 )
                    _searchClause += "WF_PROC_DEFS.DEF_NAME = '" + ProcessTemplateName + "'";

                 WFManualWorkItem[] wks = api.QueryWorkListEx( _searchClause );

                 return wks;
            }
            catch ( Exception e )
            {
                throw new Exception( "Error with GetProcessInstanceWorkItems", e );
            }
        }

  
Last Reviewed: 
Keywords: 

Add Your Comments


Name: *
Email Address:
Web Address:
Verification Code:
*
 

Details
Last Modified:Tuesday, September 20, 2011
Last Modified By: MichaelDa
Type: HOWTO
Article not rated yet.
Article has been viewed 935 times.
Options