I have a form that has an approve and deny button. These buttons will only display when the document is in edit mode.Here is my issue - the document will have the status of “Awaiting Manager Approval” and the user presses the
Approve button and they are asked if they want to save the change. If they answer “Yes”, the change is saved,
if they answer “No”, the document closes which is what it should do and if they answer “Cancel”, the user is brought back to the document on the screen.
Here is my issue, when the document is “Awaiting Manager Approval”, and the user presses “No”, the document automatically closes as it should. When the document moves to the next step of “Awaiting Sales Approval”, the user
presses the Approve button and than presses No the same as in the previous step, but instead of automatically closing as it should the user is presented with the second message asking if they want to save the document.
I have looked at the code and both use the following script in the “Approve” button and there is nothing in the Query close event both on the subform or form.
Can anyone tell me why the message is displaying at the second step of the workflow? I don’t want the message to display since the user answered “No”.
Below is the code for the Approve button.
Thank you in advance for any comments.
Jean
Code for button in otusscript :
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