|
通过按钮来触发启动一个流程,并且传一些数据到这个流程,怎么做比较好?
用下面这个代码了话,还要制定部门和人员很不方便啊,有没有好的解决方案?而且怎么传数据进去阿?
procedure TMainForm.UserStartFlow
(AFlowUrl,ADept,ARole,APerson,AStartProc,AFlowID,ASubject,ADescription:string);
var
lBizURL: TBizURL;
lFlowValue: TFlowValue;
lFlowControl: TFlowControl;
lExecutor: Business.Model.Org.TOrgURL;
begin
lBizURL := TBizURL.Create;
lFlowValue := TFlowValue.Create;
lFlowControl := TFlowControl.Create(Self.Context);
lExecutor := Org.TOrgURL.Create(ADept, ARole, APerson);
lBizURL.URL := AFlowUrl;
try
lFlowValue.IDs.Add(AFlowID); //流程ID
lFlowValue.Subject := ASubject; //流程主题
lFlowValue.Description := ADescription; //流程描述
//启动流程实例
lFlowControl.StartupFlow(lBizURL, AStartProc, lExecutor, lFlowValue);
//流程实例数据保存到数据库
lFlowControl.FlowRunnerbyIndex[0].CurrentTask.SaveToDB;
finally
lFlowControl.Free;
lFlowValue.Free;
lBizURL.Free;
end;
end; |
|