var
I : Integer;
lSubFlowInfo : TSubFlowInfo;
lGUID : String;
lFlowTask : TFlowTask;
lOrgURL : TOrgURL;
PersonList : TStringList;
sDeptID : String;
sPosiID : String;
sPersID : String;
begin
DataSetJCXM.DataSet.First;
while not DataSetJCXM.DataSet.Eof do
begin
lGUID := JSCommon.CreateGUIDStr; //创建子流程GUID
lSubFlowInfo := Command.SubFlowInfos.Add; //启动子流程实例
lSubFlowInfo.FlowValue.IDs.Add(DataSetJCXM.DataSet.FieldbyName('HTJCXMBH').AsString); //给子流程的实例传值
lSubFlowInfo.FlowValue.Subject :='子流程主题'; //赋子流程主题
lSubFlowInfo.EntryFlowTasks.Assign(Command.EntryFlowTasks);
lFlowTask := lSubFlowInfo.EntryFlowTasks.FindFlowTask('XMJC');//根据任务环节查找任务
if lFlowTask <> nil then
begin
lFlowTask.Executors.Clear;
//删除缺省执行者
sPersID := DataSetJCXM.DataSet.FieldbyName('RYID').AsString;
GetPinfo(sPersID,sDeptID,sPosiID);
lFlowTask.Executors.Add(sDeptID,sPosiID,sPersID);
end;
DataSetJCXM.DataSet.Next;
end;
end; |