If you want to get the all the active instances for the specified process application.
this TWSearch will return all the active instances.
var col1 = new TWSearchColumn();
col1.name = TWSearchColumn.ProcessInstanceColumns.ID;
col1.type = TWSearchColumn.Types.ProcessInstance;
var condition = new TWSearchCondition();
condition.column = new TWSearchColumn();
condition.column.name = TWSearchColumn.ProcessInstanceColumns.Status;
condition.column.type = TWSearchColumn.Types.ProcessInstance;
condition.operator = TWSearchCondition.Operations.Equals;
condition.value = "Active";
var condition2 = new TWSearchCondition();
condition2.column = new TWSearchColumn();
condition2.column.name = TWSearchColumn.ProcessColumns.Name;
condition2.column.type = TWSearchColumn.Types.Process;
condition2.operator = TWSearchCondition.Operations.Equals;
condition2.value = "Test";
var search = new TWSearch();
search.columns = [col1];
search.conditions = [condition, condition2];
var order1 = new TWSearchOrdering();
order1.column = col1;
order1.order = TWSearchOrdering.Orders.Descending;
search.orderBy = new Array(order1);
search.organizedBy = TWSearch.OrganizeByTypes.ProcessInstance;
var results = search.execute();
var instaceID[];
for(var i=0;i<results.rows.length;i++)
{
instaceID[] = results.rows[i].values[0];
}
this TWSearch will return all the active instances.
var col1 = new TWSearchColumn();
col1.name = TWSearchColumn.ProcessInstanceColumns.ID;
col1.type = TWSearchColumn.Types.ProcessInstance;
var condition = new TWSearchCondition();
condition.column = new TWSearchColumn();
condition.column.name = TWSearchColumn.ProcessInstanceColumns.Status;
condition.column.type = TWSearchColumn.Types.ProcessInstance;
condition.operator = TWSearchCondition.Operations.Equals;
condition.value = "Active";
var condition2 = new TWSearchCondition();
condition2.column = new TWSearchColumn();
condition2.column.name = TWSearchColumn.ProcessColumns.Name;
condition2.column.type = TWSearchColumn.Types.Process;
condition2.operator = TWSearchCondition.Operations.Equals;
condition2.value = "Test";
var search = new TWSearch();
search.columns = [col1];
search.conditions = [condition, condition2];
var order1 = new TWSearchOrdering();
order1.column = col1;
order1.order = TWSearchOrdering.Orders.Descending;
search.orderBy = new Array(order1);
search.organizedBy = TWSearch.OrganizeByTypes.ProcessInstance;
var results = search.execute();
var instaceID[];
for(var i=0;i<results.rows.length;i++)
{
instaceID[] = results.rows[i].values[0];
}
No comments:
Post a Comment