Sub Initialize
On Error GoTo errormsg
Dim depVw As NotesView
Dim depDoc As NotesDocument
Dim depID As String
Dim parentDepID As String
Dim depHead As String
Dim i As Integer
'Dim isBranchCo
depID=LinkeyUser.GetDeptNumByUserName(WF_UserName)
msgbox "depID="+depID
depHead = join(LinkeyUser.GetDirLeaderByUserName(WF_UserName),"")
msgbox "depHead="+depHead
Set depVw=linkeyuser.UserDb.getview("TreeListByFolderId")
if depHead="" then
for i=1 to 1
set depDoc=depVw.getdocumentbykey(depID,true)
if not depDoc is nothing then
parentDepID=depDoc.ParentFolderId(0)
depID=parentDepID
end if
next
end if
if WF_UserName=depDoc.DeptHead(0) then
for i=1 to 1
set depDoc=depVw.getdocumentbykey(depID,true)
if not depDoc is nothing then
parentDepID=depDoc.ParentFolderId(0)
depID=parentDepID
end if
next
end if
if not depDoc is nothing then
depHead = depDoc.DeptHead(0)
WF_Document.WF_RuleUser=depHead
else
WF_Document.WF_RuleUser=""
end if
Exit Sub
errormsg:
MsgBox " suxg Rule Error:" & Str(Erl) & " " & Error
exit sub
End Sub