Search code examples
lotus-noteslotus-dominodomino-designer-eclipse

Create two save options after editting


I want to create two save option button. I have a version tracking option with manual save. I've created one save option where it will save without adding a version. So, for adding a version, I need to click "File > Save As New Version".

For manual save, there is an option where I need to click "Save As New Version".

Save1

So, I want to add another save button where when users click it, it will save as a new version. So I don't have to click "File > Save As New Version".

enter image description here

Below is my save without save as new version.

Sub Click(Source As Button)
    Dim session As New NotesSession
    Dim workspace As New NotesUIWorkspace
    Dim db As NotesDatabase
    Dim uidoc As NotesUIDocument
    Dim doc As NotesDocument

    Set uidoc = workspace.CurrentDocument
    Set db = session.CurrentDatabase
    vpswd = Inputbox$("Pls input code to save :")

    If vpswd = "o" Then

        uidoc.EditMode = True
'       Call uidoc.FieldSetText("ALStatus" , "Draft")
        Call uidoc.FieldSetText("SaveOptions" , "1")
        Call uidoc.Save
'       uidoc.EditMode = False
        Call uidoc.Close
    End If
End Sub

How can achieve to create a LotusScript for "Save As New Version"?


Solution

  • The NotesUIDocument class has a SaveNewVersion method, so you should be able to copy the code from your existing button then just change this line in the copy:

     Call uidoc.Save

    to this:

     Call uidoc.SaveNewVersion

    It took me about 5 minutes to work this out from looking at the Help included with the Notes client. You should have been able to do the same.