0

我有一个带有批准和拒绝按钮的表格。这些按钮仅在文档处于编辑模式时才会显示。

该文档将具有“等待经理批准”的状态,并且用户按下“批准”按钮并询问他们是否要保存更改。如果他们回答“是”,则保存更改,如果他们回答“否”,则文档将关闭,如果他们回答“取消”,则用户将返回到文档,就像他们按下批准按钮时一样.

这是我的问题,当文档是“等待经理批准”并且用户按“否”时,文档会自动关闭。当文档移动到工作流的下一步 - “等待销售批准”时,用户按下批准按钮,然后按下与上一步相同的否,但不会像用户看到的那样自动关闭第二条消息询问他们是否要保存文档。

我查看了代码,并且都在“批准”按钮中使用了以下脚本,并且子表单或表单上的查询关闭事件中都没有任何内容。

谁能告诉我为什么在工作流程的第二步显示消息?由于用户回答“否”,我不希望显示该消息。

下面是批准按钮的代码。

LotusScript 中的按钮代码:

Sub Click(Source As Button) 
        Dim workspace As New NotesUIWorkspace 
        Dim askme As Integer 
        Dim tellme As Integer 
        Dim holdValue As String 
        Dim holdValue2 As String 
        Dim uidoc As NotesUIDocument 
        Dim doc As NotesDocument 
        Dim boxType As Long, answer As Integer 
        boxType& = MB_YESNOCANCEL + MB_ICONQUESTION 
        Set uidoc = workspace.CurrentDocument 

        Set doc = uidoc.Document         
        Dim num As Integer 


        If (uidoc.EditMode = True) And (DocWasSaved = False) Then 
                holdvalue = uidoc.EditMode                         
                askMe = Messagebox("Do you wish to continue?",  boxType&, "Continue?") 
                Select Case askme 

                Case 2 
                       'Equals Cancel response - no action - goes back into document.         
                Case 6         
                       'Equals Yes response - saves document                 
                       Call uidoc.FieldSetText("Action", "Approve")                 
                       Call uidoc.FieldSetText("PostAction", "Approve") 
                       Call uidoc.FieldSetText("SaveOptions", "1") 
                       Call uidoc.FieldSetText("CloseFlag", "Yes")                                 
                       Call uidoc.Save                                 
                       Call uidoc.close                         
                Case 7 
                       'User answered No, doesn't save and closes document. 
                        Call uidoc.Close                         
                End Select 
        Else                         
        End If         

End Sub
4

2 回答 2

2

您可以尝试使用该SaveOptions字段来抑制“您要保存此文档吗?”的附加对话框。将字段值设置为“0”可以在没有提示的情况下关闭文档。有关更多信息,请参阅本文

因此,您的代码示例将与此类似:

Call uidoc.Save
Call uidoc.FieldSetText("SaveOptions", "0")
Call uidoc.Close
于 2013-05-20T13:20:02.540 回答
0

除了弄乱 SaveOpetions 字段,您还可以在关闭文档后在后端进行更改。请记住,如果表单上的任何字段已被修改/更改,您将收到该提示。这就是为什么即使在取消时我也会建议使用 uidoc.Save() 的原因。

这是我的(未经测试的)代码:

Sub Click(Source As Button)
 Dim ws As New NotesUIWorkspace
 Dim uidoc As NotesUIDocument
 Dim doc As NotesDocument
 Dim result As Integer
 Dim boxType As Long

 boxType = MB_YESNOCANCEL + MB_ICONQUESTION
 Set uidoc = workspace.CurrentDocument

 result = Messagebox("Do you wish to continue?", boxType, "Continue?")
 Select Case result
 Case 2
   'Equals Cancel response - no action - goes back into document. 
 Case 6 
   'Equals Yes response - saves document and closes it
   Call uidoc.Save()
   set doc = uidoc.Document
   Call uidoc.Close(True)
   Call doc.ReplaceItemvalue("Action", "Approve") 
   Call doc.ReplaceItemvalue("PostAction", "Approve")
   Call doc.ReplaceItemvalue("SaveOptions", "1")
   Call doc.ReplaceItemvalue("CloseFlag", "Yes") 
   Call doc.Save(True,False)
 Case 7
   'User answered No, doesn't save and closes document.
   'Note: If any field has changed, the user will get the save yes/no prompt.
   'I would add:
   'Call uidoc.Save()
   Call uidoc.Close 
End Select

End Sub 
于 2013-05-20T14:34:49.210 回答