Problem solve Get help with specific problems with your technologies, process and projects.

How can a button on a form save a new doc and return a value to the calling code?

I have a form in the Notes Client. A LotusScript button on the form creates a new Notes document object, assigns values to it from the current document and then opens it up in a DialogBox so the user can finish entering information.

I want the dialogbox to pass back to the calling code whether the user clicked ok or cancel. If I use DialogBox default buttons the OK passes a True back, but does NOT save the newly created document. If I use my own OK button to save and close, then a false is passed back to the calling code.

Is there a way to save this newly created document if the user clicks OK and return that value back? I can't pre-save it because the DialogBox needs to be validated.

The easy way to do this is to have the LotusScript code that calls the DialogBox check the return value, and if it's True, that code saves the new document. This should work unless you have a Rich Text field in the dialog (Rich Text is not passed back to the caller of DialogBox).

If you must save the dialog document while the dialog is still open, then your OK button can use the RefreshParentNote command (see RefreshParentNote @Command or Tech Tip: Dialog buttons in Notes 6.x) to update field values for the caller. I think that will make the DialogBox call return True; if not, you can set a field to tell the caller that OK was clicked.

Dig Deeper on LotusScript

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/ community. These cheat ...