Skip to main content

ProcessInstances.GetActivityInstanceByIdAsync

Description

The API gets an activity instance of a specified activity ID inside the connected Control Room.

Signature [C#]

Task<ActivityInstance> GetActivityInstanceByIdAsync(string processInstanceId, string activityId);

Properties

Input

PropertyDescription
processInstanceIdThe process instance id in which the activity instance is located.
activityIdThe activity ID for which the activity instance has to be retrieved.

Output

PropertyDescription
Task<ActivityInstance>Returns activity instance.

Remarks

Use GetActivityInstanceByIdAsync API to get the activity instance of a process instance inside the connected Control Room.

Example

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

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

ActivityInstance activityInstance = Task.Run(() => context.ProcessInstances.GetActivityInstanceByIdAsync(processInstanceId, activityId)).Result;
System.Console.WriteLine("Activity Name: " + activityInstance.Name);
}
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;
}