Process variables
Subscribe to process type events, and then read or operate process variables in the callback method.
//start a new process instance
IWorkflowService wfService = new WorkflowService();
var wfResult = wfService.CreateRunner(runner.UserID, runner.UserName)
.UseApp(runner.AppInstanceID, runner.AppName, runner.AppInstanceCode)
.UseProcess(runner.ProcessGUID, runner.Version)
.Subscribe(EventFireTypeEnum.OnProcessStarted, (delegateContext, delegateService) => {
var processInstanceID = delegateContext.ProcessInstanceID; delegateService.SaveVariable(ProcessVariableTypeEnum.Process, "name", "book"); delegateService.SaveVariable(ProcessVariableTypeEnum.Process, "amount", "30");
return true;
})
.Start();