banner



How To Create A Document Link In Lotus Notes

Document, view, and database links offer a quick and easy way to reference database information. Links are often embedded in email messages and allow users to jump directly to a referenced item when clicked. This routine illustrates how to generate and embed a link in a Rich Text field.

How It Works

This is a built-in feature of the Lotus Notes client. Document, view, and database links are generated using the AppendDocLink method. Links can only be inserted in a Rich Text field or object.

Three parameters are associated with the AppendDocLink method. The first parameter passed to the AppendDocLink method must be a document, view, or database object. The second parameter is optional and displays in the bottom of the Lotus Notes client when the mouse hovers over the link. A third parameter can also be supplied that replaces the icon with a text link.

A.13.2

Implementation

The following code illustrates how to attach both the document and database links. When the button is clicked, an email message is sent with the links to the current database and document. To implement this technique, create an action button and insert the following LotusScript code in the Programmer's pane.

Sub Click(Source As Button)   Dim w As NotesUIWorkspace  Dim s As NotesSession  Dim db As NotesDatabase  Dim uidoc As NotesUIDocument  Dim doc As NotesDocument  Dim newdoc As NotesDocument  Dim rtitem as NotesRichTextItem  Dim Person As NotesName  Set w = New NotesUIWorkspace  '-----------------------------------------------------------------  ' Set object values  '-----------------------------------------------------------------  Set s = New NotesSession  Set db = s.CurrentDatabase  Set uidoc = w.CurrentDocument  Set doc = uidoc.Document  Set newdoc = New NotesDocument(db)  Set Person = New NotesName(s.UserName)   '-----------------------------------------------------------------  ' Create the email and richtext object  '-----------------------------------------------------------------  newdoc.Form = "Memo"  newdoc.SendTo = Person.Abbreviated  newdoc.Subject = "Sample document and database link"  Set rtitem = New NotesRichTextItem(newdoc, "Body")   '-----------------------------------------------------------------  ' Append the document link (doc)  '-----------------------------------------------------------------  Call rtitem.AddNewLine(1)  Call rtitem.AppendDocLink(doc, db.Title)  Call rtitem.AppendText(" <--- Click to open document.")   '-----------------------------------------------------------------  ' Append the database link (db)  '-----------------------------------------------------------------  Call rtitem.AddNewLine(1)  Call rtitem.AppendDocLink(db, db.Title)  Call rtitem.AppendText(" <--- Click to open database.")   '-----------------------------------------------------------------  ' Send message  '-----------------------------------------------------------------  newdoc.Send (False)  Msgbox "Sample email sent"  End Sub        

Troubleshooting

A default view must be associated with the database in order to implement this solution. Although there are no specific references to any view in the LotusScript code, a default view association must exist in order to generate the document link. If a default view has not been established, an error message similar to Figure 13.27 will display.

Figure 13.27. No default view specified error message

To assign a default view, select and open the view in the Domino Designer client. Select the Design > View Properties menu option to display the properties dialog. Switch to tab 2 and select the option Default when database is first opened (see Figure 13.28).

Figure 13.28. "Default when database is first opened" setting in the View properties dialog

Save and close the view.

Tip

If users are unable to open the document or database when clicked, you may need to have them create a connection document in order to correct the error "Unable to find path to server." See Chapter 21, "Troubleshooting," for additional information on troubleshooting and how to create a connection document. If the user is still unable to access the document or database, the ACL may need to be updated to grant access to the database (see Chapter 19, "Security," for additional information on database security settings).

How To Create A Document Link In Lotus Notes

Source: https://flylib.com/books/en/2.348.1/add_a_document_view_or_database_link_to_a_rich_text_field.html

Posted by: leetabefore.blogspot.com

0 Response to "How To Create A Document Link In Lotus Notes"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel