Skip to main content
Version: Current

ProcessInstances.UpdateModelDataAsync

Description

Updates the model data for a specified workflow instance within a process instance in the connected AI Command Center.

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


Signature [C#]

Task UpdateModelDataAsync(ModelData modelData);

Parameters

Input

PropertyDescription
modelDataContains the Process Instance ID, Workflow Instance ID, and the model 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 model data for a specific workflow instance programmatically.


Example

C#
public void UpdateModelData()
{
    IControlRoomContext context = LoginControlRoom();

    Dictionary<string, string> data = new Dictionary<string, string>()
{
{ "modelVariable", "Value" }
};

    ModelData modelData = new ModelData()
{
        ProcessInstanceId = "e42a93f5d53245d788909fd655b41cfe",
        WorkflowInstanceId = "58bfe04d347540188dfdb55f2e16f5ec",
        Data = data
};

    context.ProcessInstances.UpdateModelDataAsync(modelData).Wait();

    System.Console.WriteLine("Workflow instance model data has been updated successfully.");
}
C#
public IControlRoomContext LoginControlRoom()
{
IControlRoomContext context;
string connectionString;

connectionString = "ServerUrl=https://demo.onnitellibuddies.com;UserName=demoadmin;Password=password";
context = new ControlRoomContext(connectionString);

context.Open();
return context;
}