Skip to main content
Version: Current

ProcessInstances.UpdateModelDataAsync

Description​

Updates the Workflow Data for a specified workflow instance within a process instance in the connected AI Command Center.

This API allows runtime modification of Workflow Data variables for an active workflow instance without affecting other workflows within the same process instance.


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 UpdateModelDataAsync(ModelData modelData);

Parameters​

Input​

PropertyDescription
modelDataContains the Process Instance ID, Workflow Instance ID, and the Workflow Data variables to update.

Remarks​

  • ProcessInstanceId identifies the parent process instance.
  • WorkflowInstanceId identifies the specific workflow instance within the process.
  • Only the variables provided in the Data collection are updated.
  • The operation executes asynchronously.
  • The targeted workflow instance must be active.

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


Example​

C#
public async Task UpdateModelData()
{
IControlRoomContext context = LoginControlRoom();
try
{
Dictionary<string, string> data = new Dictionary<string, string>()
{
{
"modelVariable",
"Value"
}
};
ModelData modelData = new ModelData()
{
ProcessInstanceId = "e42a93f5d53245d788909fd655b41cfe",
WorkflowInstanceId = "58bfe04d347540188dfdb55f2e16f5ec",
Data = data
};
await context.ProcessInstances.UpdateModelDataAsync(modelData);
System.Console.WriteLine("Workflow instance Workflow Data has been updated successfully.");
}
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.