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
| Property | Description |
|---|---|
processInstanceId | The ID of the parent process instance. |
workflowInstanceId | The ID of the workflow instance within the process. |
fields | Optional. A collection of model field keys to filter the returned data. |
Returns
| Type | Description |
|---|---|
modelData<string> | A JSON string containing the requested model data. |
Remarks
- The
processInstanceIdidentifies the parent process. - The
workflowInstanceIdidentifies the specific workflow instance. - If
fieldsis null, all model data is returned. - If
fieldscontains 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;
}