Robert
Robert

Reputation: 1241

Compose a new document in a embedded view and set field value in Lotus Notes

I have the following situation:

  1. The mask Person has a embedded view with documents of form Notes (notes about the person).
  2. The mask Person has a Person_ID field.

I need an action in the embedded view that do the following actions:

  1. Creates a new Notes document.
  2. Reads the field Person_ID from the mask where the view is embedded.
  3. Stores the value in the new created document in the field Notes_Refto.
  4. Opens the new document in the edit mask.

Best regards Robert

Upvotes: 1

Views: 1228

Answers (2)

Casper Skovgaard
Casper Skovgaard

Reputation: 426

If you want the action in the embedded view, you can do this:

Create the action in the embedded view. Use formula to run an agent

@Command([RunAgent]; "(CreateNotes)")

The agent should look like this:

Dim personDoc As NotesDocument
Set personDoc = workspace.Currentdocument.Document

Dim notesDoc As New NotesDocument(app.CurrentDatabase)

Call notesDoc.Replaceitemvalue("Form", "Notes")
Call notesDoc.Replaceitemvalue("Person_ID", personDoc.ID(0))

Call workspace.Editdocument(True, notesDoc)

Upvotes: 1

Knut Herrmann
Knut Herrmann

Reputation: 30970

Add this button to your form Person, not into the embedded view. You can position the button right above or beneath the embedded view.

Let the new document inherit fields from Person document like the Person_ID field.

Upvotes: 2

Related Questions