Skip to main content
Version: Current

ProcessInstances.GetModelDataByWorkflowAsync

Description​

Retrieves the Workflow Data for a specified workflow instance within a process instance from the connected AI Command Center.

You can optionally specify a set of Workflow Data field keys to retrieve only selected data.


Workflow Data is the current display name for Model Data. The SDK method and model names retain ModelData for backward compatibility. See Workflow Data.

Signature [C#]​

Task<string> GetModelDataByWorkflowAsync(string processInstanceId, string workflowInstanceId, IEnumerable<string> fields = null);

Parameters​

Input​

PropertyDescription
processInstanceIdThe ID of the parent process instance.
workflowInstanceIdThe ID of the workflow instance within the process.
fieldsOptional. A collection of Workflow Data field keys to filter the returned data.

Returns​

TypeDescription
Task<string>A task returning a JSON string containing the requested Workflow Data.

Remarks​

  • The processInstanceId identifies the parent process.
  • The workflowInstanceId identifies the specific workflow instance.
  • If fields is null, all Workflow Data is returned.
  • If fields contains values, only matching Workflow Data variables are returned.
  • The operation executes asynchronously.

Use this API to retrieve runtime Workflow Data for a specific workflow instance.


Example​

C#
public async Task GetModelDataByWorkflow()
{
IControlRoomContext context = LoginControlRoom();
try
{
string processInstanceId = "e42a93f5d53245d788909fd655b41cfe";
string workflowInstanceId = "58bfe04d347540188dfdb55f2e16f5ec";
var fields = new[]
{
"InvoiceId",
"Amount"
};
string modelData = await context.ProcessInstances.GetModelDataByWorkflowAsync(processInstanceId, workflowInstanceId, fields);
System.Console.WriteLine("Workflow Data: " + modelData);
}
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.