Find Instances of a Specific Process |
Scroll |
Besides searching for document operations, you can find all running and/or finished instances of a specified process. The guide and code sample below illustrates a typical workflow query. The reference page of the ExecuteWorkflowQueryForProcess operation contains more details on parameters and usage.
If you want to get all instances of all workflow processes, use the ExecuteWorkflowQueryForAll operation.
1 |
Create a channel factory to the web service endpoint. |
2 |
Create a channel to the web service endpoint. |
3 |
Create requested parameters. Define a process number. |
4 |
Execute the query on the server. |
5 |
Display the results in a message box. |
// 1. Create a channel factory to the web service endpoint
...
ChannelFactory<IThereforeService> channelFactory = new ChannelFactory<IThereforeService>(binding, endpoint);
// 2. Create a channel to the web service endpoint
IThereforeService service = channelFactory.CreateChannel();
// 3. Create request parameters
ExecuteWorkflowQueryForProcessParams parameters = new ExecuteWorkflowQueryForProcessParams();
parameters.ProcessNo = 1;
parameters.WorkflowFlags = Therefore.WebAPI.Service.Contract.v0001.Enums.WSWorkflowFlags.AllInstances;
// 4. Execute the query on the server
ExecuteWorkflowQueryForProcessResponse response = service.ExecuteWorkflowQueryForProcess(parameters);
// 5. Display the results in a message box
MessageBox.Show("Number of rows returned: " + response.WorkflowQueryResult.ResultRows.Count);