Getting a document highlighted in a view

Here's a look at how to get a hold of the back end document when a user selects a document in a view. It's useful for someone wanting to make a LotusScript function that will operate similar to the Copy As New function in the Inbox, but using LotusScript so that only certain fields on the form are copied into the new document. This can be done either for a Notes client or a Web browser. Notes client: The best way to do this is to have the action button run an agent. The agent would run on selected documents. In the agent, start by setting a document collection equal to db.UnprocessedDocuments. This is a handle to the selected document(s). You can get the first doc and you have a handle to the back end doc you want. set collection = db.UnprocessedDocuments set doc = collection.GetFirstDocument Check out the topic -- UnprocessedDocuments property -- in the Notes Help database for more detailed information and sample code. The Web: You can access the session.DocumentContext to determine the document the browser is accessing. By assigning this to a NotesDocument, you can access any of the document's fields and most of the methods and properties. In addition, many CGI variables are available from the document. The following snippet of code gets the browser type and user name. Dim session As New NotesSession Dim doc As NotesDocument Set doc = session.DocumentContext User = doc.Remote_User(0) Browser = HTTP_User_Agent(0) You can check the topic, DocumentContext Property, in the Notes Help database for more detailed information and sample code.

Dig Deeper on LotusScript

  • Favorite iSeries cheat sheets

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