ProcessInstances.GetWorkflowInstancesByProcessInstanceIdAsync
Description
Retrieves the list of workflow instances associated with a specified process instance ID from the connected AI Command Center.
Signature [C#]
Task<List<WorkflowInstanceData>> GetWorkflowInstancesByProcessInstanceIdAsync(string instanceId);
Parameters
Input
| Property | Description |
|---|---|
instanceId | The process instance ID for which workflow instances need to be retrieved. |
Returns
| Type | Description |
|---|---|
Task<List<WorkflowInstanceData>> | A list of workflow instances associated with the specified process instance. |
Remarks
- The
instanceIdrepresents the parent process instance. - The API returns all workflow instances linked to the specified process instance.
- The operation executes asynchronously.
Use this API to retrieve workflow-level execution details within a process instance.
Example
C#
public async Task GetWorkflowInstancesByProcessInstanceId()
{
IControlRoomContext context = LoginControlRoom();
try
{
string processInstanceId = "e42a93f5d53245d788909fd655b41cfe";
List<WorkflowInstanceData> workflowInstances = await context.ProcessInstances.GetWorkflowInstancesByProcessInstanceIdAsync(processInstanceId);
foreach (var workflow in workflowInstances)
{
System.Console.WriteLine("Workflow Name: " + workflow.Name);
}
}
finally
{
context.Close();
}
}
Connection helper
public IControlRoomContext LoginControlRoom()
{
string RequiredSetting(string name) => Environment.GetEnvironmentVariable(name) ?? throw new InvalidOperationException($"Set {name} before running this example.");
string serverUrl = RequiredSetting("INTELLIBUDDIES_SERVER_URL");
string userName = RequiredSetting("INTELLIBUDDIES_USERNAME");
string password = RequiredSetting("INTELLIBUDDIES_PASSWORD");
string connectionString = $"ServerUrl={serverUrl};UserName={userName};Password={password}";
IControlRoomContext context = new ControlRoomContext(connectionString);
context.Open();
return context;
}
See Get started for namespaces, configuration, and context cleanup, and SDK usage for error handling.