Domino on Linux/Unix, Troubleshooting, Best Practices, Tips and more ...


Daniel Nashed


    Passing values back from Notes DialogBox with OK button.

    Daniel Nashed  2 August 2021 09:24:53

    This sounds like nothing complicated. But it turned out the devil is in the detail.
    When you want to create a DialogBox and have special logic in your OK button, you have to build your own OK/Cancel button and hide the original OK and Cancel buttons.
    This provides full control on the logic in the sub-form presented by the dialog box.

    The dialog box it self is straightforward. I am creating TempDoc and pass it to the dialog box and I used a table to display.

    flag = workspace.Dialogbox(FORM,True, True, True, False, False, False, DialogTitle, TempDoc, True, True, False)

    The Cancel button is also straightforward


    If you don't do anything special, closing the window will make you to loose any values - That's what I want.
    The tricky part was the OK button. You can set any field with a button and I am also using it to display error messages in a field on the sub form in the table.

    But the dialog box did not return any values.

    It turned out there are two parts needed:

    • @PostedCommand([RefreshParentNote])

      This refreshes the back-end document passed via TempDoc.
    • Both commands (see example below) have to be @PostedCommand instead of @Command to have them executed after all other operations like setting your variable values!

    Here is the code in my button. The OK button will only close the window, when there are no validation errors. Else the error is displayed.
    I tried to use validation formulas in the sub and the standard OK button earlier. But this turned out to be not a good idea.
    And this looks like the most elegant approach giving me a very clean dialog box to select values and to report errors back.

    FIELD ErrorMessage:ERR_ALL;
    FIELD SelectedAction := Action;

    @If (ERR_ALL = ""; @Do( @PostedCommand([RefreshParentNote]);@PostedCommand([CloseWindow])); "")

    The RefreshParentNote is documented for Lotus Script and for @formulas. I just overlooked it in documentation.
    And it does only work with
    PostedCommand if you have other logic around it in @formulas

    -- Daniel


    1Sebastian Grund  09.02.2022 10:17:04  Passing values back from Notes DialogBox with OK button.

    Excellent - thanks a lot!

    Wonder why this isn't part of the official documentation :-?

    Kind regards,




      • [IBM Lotus Domino]
      • [Domino on Linux]
      • [Nash!Com]
      • [Daniel Nashed]