Skip to main content
Version: Current

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​

PropertyDescription
instanceIdThe process instance ID for which workflow instances need to be retrieved.

Returns​

TypeDescription
Task<List<WorkflowInstanceData>>A list of workflow instances associated with the specified process instance.

Remarks​

  • The instanceId represents 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.