----------------------- 提交任务
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim workItem As NotesItem
Dim workitemId As String
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
'判断是否是新文档
If(doc.IsNewNote) Then
Msgbox("新文档不允许操作!")
Exit Sub
End If
'检测该文档是否已经处理完成
Dim Finishoed As NotesItem
Set Finished = doc.GetFirstItem("Finished")
If(Finished.Text = "1") Then
Msgbox("该任务已经处理完成!")
Exit Sub
End If
'获取用户的审批意见
Dim comment As String
comment =Inputbox("请输入意见","H3 BPM Suite","同意")
If(comment="") Then Exit Sub
'获取任务ID
Set workItem = doc.GetFirstItem("WorkItemID")
workitemId = workitem.Text
'调用H3接口进行任务提交
Dim oSOAP As Variant
Set oSOAP = CreateObject("MSSOAP.SoapClient30")
Call oSOAP.mssoapinit("http://localhost:8010/Portal/BPMService.asmx?WSDL", "", "")
oSOAP.SubmitWorkItem(workitemId)
'标记任务完成,并且是提交,1表示提交
Finished.Text = "1"
Finished.Values = "1"
Call doc.Save(0,0,0)
Msgbox("任务提交完成!")
End Sub
------------------- 驳回任务
Sub Click(Source As Button)
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim workItem As NotesItem
Dim workitemId As String
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
'判断是否是新文档
If(doc.IsNewNote) Then
Msgbox("新文档不允许操作!")
Exit Sub
End If
'检测该文档是否已经处理完成
Dim Finishoed As NotesItem
Set Finished = doc.GetFirstItem("Finished")
If(Finished.Text = "1") Then
Msgbox("该任务已经处理完成!")
Exit Sub
End If
'获取用户的审批意见
Dim comment As String
comment =Inputbox("请输入意见","H3 BPM Suite","不同意")
If(comment="") Then Exit Sub
'获取任务ID
Set workItem = doc.GetFirstItem("WorkItemID")
workitemId = workitem.Text
'调用H3接口进行任务提交
Dim oSOAP As Variant
Set oSOAP = CreateObject("MSSOAP.SoapClient30")
Call oSOAP.mssoapinit("http://localhost:8010/Portal/BPMService.asmx?WSDL", "", "")
oSOAP.ReturnWorkItem(workitemId)
'标记任务完成,并且是提交,2表示提交
Finished.Text = "2"
Finished.Values = "2"
Call doc.Save(0,0,0)
Msgbox("任务提交完成!")
End Sub