Sub Postopen(Source As Notesuidocument)
Print "Opening Document"
DocWasSaved = False
Dim WorkflowObject As String
Set w = New NotesUIWorkspace
Set UIDoc = w.CurrentDocument
Set doc = source
Set note = source.Document
在我的Querysave事件中,我正在调用子程序 - 这是其中之一。 SetNextApprover
以下是SetNextApprover的代码:
Sub SetNextApprover
On Error Goto ProcessError
Print "SettingNextApprover"
Dim holdingStatus As String
holdingStatus = note.DocStatus(0)
Dim email As String
Dim email2 As String
Dim nam As NotesName
Dim newCommon As String
Dim newCommon2 As String
Dim SaveOptions As Variant
Dim holdingStep As String
Dim holdOldStatus As String
Dim plannerName As String
Dim plannerName2 As String
Dim curName As NotesName
Dim db As NotesDatabase
Set db = s.CurrentDatabase
Set curName = s.CreateName(s.UserName)
CurrentUser = curName.Common
Dim holdFunction As String
Select Case holdingStatus
Case "Awaiting Initial Review"
Dim MaximumApprovers As String
MaximumApprovers = note.MaximumApprovers(0)
Dim HoldSubmitBy As String
HoldSubmitBy = note.submitBy(0)
Select Case HoldSubmitBy
Case "CSR"
If note.Function1(0) <> "" Then
If note.App1Name(0) <> "" Then
If note.App1Name(0) = CurrentUser Then
If note.Status1(0) <> "" Then If note.App2Name(0) <> "" Then
nextApprover = note.App2NameNote(0)
plannerName = note.App2NameNote(0)
note.nextApproverCommon = plannerName
email = lookupEmailAddress(plannerName) note.NextApprover = email
End If
End If
End Select
Exit Sub
ProcessError:Msgbox "Error(" & Cstr(Err) & ") -> " &
Error$(Err), 16, "SetNextApprover"
Exit Sub
End Sub
我遇到的问题是该行的值&gt;&gt; note.NextApprover = email&lt;&lt;不会使用电子邮件值保留NextApprover字段的文档中的值。
谁能告诉我我做错了什么。我之前做过这些类型的更新,但他们已经工作了 我正处于紧张状态,任何评论都非常感谢。
谢谢。 让
答案 0 :(得分:2)
QuerySave事件在保存之前发生。
您正在更新note.nextApproverCommon,但NotesUIDocument(source)中的字段nextApproverCommon未更改。然后在QuerySave子函数返回后进行保存,并且NotesUIDocument的nextApproverCommon字段中的旧值将覆盖您在note.nextApproverCommon中写入的值。
答案 1 :(得分:0)
首先检查理查兹的回答。
因此,您应该操作NotesUIDocument中的值,或者在保存后操作该值。