sitrucj
sitrucj

Reputation: 118

Creating two linked forms

I have a form that I want to be able to open another form from with an action button.

Currently the button opens a new form each time with @Command([compose]; "form2"); but I would only like it to open a new form only if there hasn't been a form saved. If there is an existing form2 relating to form1 I want to open the existing form2 for continued editing.

I assume this has something to do with a UNID but I am new at this and have had no success. Any help would be appreciated.

Upvotes: 0

Views: 104

Answers (1)

Karl-Henry Martinsson
Karl-Henry Martinsson

Reputation: 2795

I would do something like this: When you create a document using Form2 (let's call it "Doc2") from a document created with Form1 (let's call that document "Doc1"), you store the UniversalID of Doc1 in Doc2. You also need to design a (hidden) view, displaying all documents created with Form2. Column 1 is sorted and contains the field where you stored the UniversalID oc Doc1.

The last thing you do is to rewrite your action button on Form1. You need to use Lotusscript for this. Perform a view lookup using the GetDocumentByKey method of the NotesView class to get Doc2. If you get a document object back, you knwo you have a related document and you exit the code. If the NotesDocument object is Nothing, you continue. Use the ComposeDocument method of the NotesUIWorkspace class to create the new document.

Upvotes: 2

Related Questions