Search code examples
lotus-noteslotus-dominolotusscript

Open new form in dialogbox from view


I have a form called PCBatchInfo. In this form, there only have 4 field which is BatchNo, Inspector, Start date, and End Date. I will then open this form and insert the information.

On other side, I have Computer form with many field which is use to show all document in view.

PCBatchInfo and Computer form have same field which is PBatchNo. So, what I will do is, I insert BatchNo in PCBatchInfo. Then when I save it, it will also change BatchNo for all Computer document.

I want to open new PCBatchInfo form in dialogbox in view. As I do some research, dialogbox only can open existing document using Queryopendocument.

Let's say, I click button in view then it will show dialogbox with PCBatchInfo form. I insert all information required, then save. Can I open this form using dialogbox from view using a button?

UPDATE

I have found a way to use dialogbox but couldn't get to save the form. Code is as below.

varResult = ws.DialogBox("PCBatchInfo", True, True, False, False, True, False, "Please insert all information below", dialogDoc, False, False, True)
    If varResult Then
        batchValue = dialogDoc.BBatchNo(0)
        inspectorValue = dialogDoc.BInspector(0)
        dateValue1 = dialogDoc.BStart(0)
        dateValue2 = dialogDoc.Bend(0)
    End If

Can anyone help me how can I save form from dialogBox? Thanks in advance!


Solution

  • In pseudo code:

    Set dbdoc= New NotesDocument(db)
    Rv= ws.DialogBox(....., dbdoc, ...)
    If user clicked Ok then
        Dbdoc.Form= "YourFormName"
        Dbdoc.Save
    Fi
    

    So you create a new NotesDocument before calling DialogBox, you can initialize fields there if you want, then the DialogBox opens, and when it is closed you have to check the return value. If the user clicked Ok, you have to complete the document yourself, by setting Form explicitly, and maybe some other things, and then you can save the document.