The RegionDoubleClick event for a view can be used to trigger the creation of a new document. When a user double-clicks on a calendar date, a new document is created, and the date field is automatically populated with the selected calendar date.
How It Works
When the user clicks on a calendar date, the current date is retrieved. Then a new document is created, the appropriate field on the form is populated, and the form is displayed to the user. Be sure that the field used to generate the calendar view is also the field on the form that is populated with the calendar date.
Implementation
Create a calendar view and insert the following LotusScript code in the Regiondoubleclick event in the Programmer's pane. Be sure to replace FORM and FIELD with actual design element names. If other fields on the form need to be present, insert the additional statements before calling the "EditDocument" statement.
Sub Regiondoubleclick(Source As Notesuiview)
'------------------------------------------------------- ' Define the objects '------------------------------------------------------- Dim s As NotesSession Dim db As NotesDatabase Dim doc As NotesDocument Dim uidoc As NotesUIDocument Set ws = New NotesUIWorkspace Set s = New NotesSession Set db = s.CurrentDatabase Dim newdoc As New NotesDocument(db) '------------------------------------------------------- ' Set the form name and date field ' Replace FORM with a valid form name ' Replace FIELD with a valid date field name '------------------------------------------------------- newdoc.form = "FORM" newdoc.FIELD = Source.CalendarDateTime REM set other default field values here (as needed) '------------------------------------------------------- ' Create document '------------------------------------------------------- Set uidoc = ws.EditDocument (True, newdoc) End Sub
An Introduction to the Lotus Domino Tool Suite
Getting Started with Designer
Navigating the Domino Designer Workspace
Domino Design Elements
An Introduction to Formula Language
An Introduction to LotusScript
Fundamentals of a Notes Application
Calendar Applications
Collaborative Applications
Reference Library Applications
Workflow Applications
Web Applications
Design Enhancements Using LotusScript
Design Enhancements Using Formula Language
View Enhancements
Sample Agents
Miscellaneous Enhancements and Tips for Domino Databases
Data Management
Security
Application Deployment and Maintenance
Troubleshooting
Appendix A. Online Project Files and Sample Applications
Appendix B. IBM® Lotus® Notes® and Domino®Whats Next?