Skip to main content

Adding the User Who Started the Process When Starting the Process with Code

The code required to set the user in the process of triggering the process with code is found in the example below.

           process is created
var process = ServiceApi.WorkflowManager.Create("ttrial239","Flow2",0). Result;

The user who initiates the flow is set (UserID is given in long type)
long userid = 2;
process. SetStarterUserByUserId(userid). Wait();

The form in the stream is accessed
var form = process. Documents["Document1"]. FormInstance;

As an example, the textbox in the form is set
form. Controls["TextBox1"]. Value = "substream";

The form is saved
form. Save();

It is selected with which event the flow will be advanced
process. StartingEvent = process. Events[4];

The flow is advanced
process. SaveAndContinue();