我在afterflowout事件中写了如下代码来获取人员名称,执行到红色部分就报错:Access violation at address 024F1506 in module 'CLRModel.bpl'. Read of address 0000004C,是为什么,该怎么解决?
procedure THYJLZCT.FlowBroker1AfterFlowOut(Sender: TObject; Command: TFlowOutCommand);
var
i:integer;
lperson:Business.Model.Org.TPerson;
s:string;
lname:string;
lsTemp:string;
begin
lname:='';
for i:=0 to Command.FlowTasks.FindFlowTask('FJ_1_HYJL').Executors.Count-1 do
begin
s:=Command.FlowTasks.FindFlowTask('FJ_1_HYJL').Executors.Items.PersonID;
lPerson:= org.OrgSys.OrgSystem.GetPerson(s);
lsTemp:= lPerson.DisplayName;
if i=0 then lname:=lsTemp
else lname:=lname+','+lsTemp;
end;
楼主在flowbroker的afternotify事件中添加如下代码试试:
procedure TYWLC1.ProcUnitRKAfterNotify(Sender: TObject; Command: TFlowNotifyCommand);
var i,j :integer;
begin
for i:=0 to command.FlowTasks.Count-1 do
begin
for j:=0 to command.FlowTasks.Executors.count-1 do
begin
Dialogs.ShowMessage(command.FlowTasks.Executors[j].PersonID);
end;
end;
end;