Beispiel #1
0
        public ProcessInstance CreateNewProcessInstance(string processDefinitionKey, Guid dossierId)
        {
            var workflowInstance = new WorkflowInstanceIn();

            workflowInstance.ProcessDefinitionKey = processDefinitionKey;
            workflowInstance.Variables.Add(new WorkflowInstanceVariable()
            {
                Name = "DossierId", Value = dossierId
            });

            var returnInstance = _workflowService.CreateProcessInstance(workflowInstance).Result;

            var processInstance = new ProcessInstance()
            {
                Id = returnInstance.Id, BusinessKey = returnInstance.BusinessKey, ProcessDefinitionKey = returnInstance.ProcessDefinitionKey, TenantKey = returnInstance.TenantKey
            };

            returnInstance.Variables.ForEach(x => processInstance.Variables.Add(new ProcessVariable()
            {
                Name = x.Name, Value = x.Value
            }));

            return(processInstance);
        }