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 ); } } |
| |
|