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.
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.
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.
This was first published in March 2000
Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.