core_st
core_st

Reputation: 63

Create new document with autofilled field - Lotus Script

I'm not sure, that title is correct, but i'll try to describe my qyestion in more detail. What i have? In Lotus db i have view V1 with two columns - names and address. Also i have two forms (for simplicity - F1 and F2). F1 has two fields: "Recipient" (names) and Title (text string) and Button "Send". F2 also has field Title (text string). After opening DB person can choose one document from view V1 and press button "Create", which creates new document on F1, where field Recipient takes chosen address from view V1. Then person fills field Title and press button "Send" to send message for Recipient with doc.Subject = Title . On this stage everything is clearly understandable

What i need? In this mail, Recipient should receive link for creating new document on form F2, with automatic filling for the field "Title" with the "Subject" value from this mail.

Upvotes: 0

Views: 1122

Answers (2)

Richard Schwartz
Richard Schwartz

Reputation: 14628

Notes has a feature called "Send form in document". I would use that feature when I send the message to the user. The message that you send would not be an ordinary "Memo". It would actually be a custom form with a button that contains your code, and it would appear in the recipient's Inbox just like an ordinary email.

To do this, I would create another form F3. This is the form that you will email. Add whatever fields you want to this form. Also add a button with code to open your database, create a document using F2, and populate the fields of F2 with the data that you sent in F3.

Then go into F1 and modify the code that is sending the message. (Since you haven't shown any of your code, I'm assuming in your LotusScript code you have named the NotesDocument variable "msg".) Change it to set msg.Form="F3", and then in your call to msg.Send be sure to set the first argument to true. This will activate the store form in document feature, so the recipient will get a copy of F3 included inside the message, and the button will be functional.

Upvotes: 1

Karl-Henry Martinsson
Karl-Henry Martinsson

Reputation: 2795

This is how I would solve it:

  • A document ("Doc1") is created using Form1.
  • The fields are populated and the 'Send' button is clicked.
  • The 'Send' button will create a new document ("Doc2") using Form2.
  • The code will populate the 'Title' field on "Doc2" with the value of 'Title' on "Doc1", and create a new email. The email will contain a doclink to "Doc2", so the recipient can click on it to open the document.
  • Save "Doc1" and "Doc2" and close both documents.

Use the AppendDocLink method of the NotesRichTextItem class to create the doclink.

Upvotes: 0

Related Questions