Skip to main content
Version: Current

ProcessInstances.GetModelDataByWorkflowAsync

Description

Retrieves the model data for a specified workflow instance within a process instance from the connected AI Command Center.

You can optionally specify a set of model field keys to retrieve only selected 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 model field keys to filter the returned data.

Returns

TypeDescription
modelData<string>A JSON string containing the requested model data.

Remarks

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

Use this API to retrieve runtime model data for a specific workflow instance.


Example

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

    string processInstanceId = "e42a93f5d53245d788909fd655b41cfe";
    string workflowInstanceId = "58bfe04d347540188dfdb55f2e16f5ec";

    var fields = new[] { "InvoiceId", "Amount" };

    string modelData = context.ProcessInstances
.GetModelDataByWorkflowAsync(
            processInstanceId,
            workflowInstanceId,
            fields)
.Result;

    System.Console.WriteLine("Model Data: " + modelData);
}
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;
}