Manage Learn to apply best practices and optimize your operations.

Print a greeting in the status bar

Code to print a greeting in the status bar

The following code prints a greeting in the status bar when a user enters a database, creates a document at the same time, and prints a goodbye greeting in the status bar when a user exits the database. This can be used by the administrator or developer to track when and who has accessed the database.


  1. Place this code in the Postopen event of the Database Script:

    @Command([ToolsRunMacro];"(Salutations)")
  2. Create the agent Salutation with Manually from Agent List set. The agent prints the salutations at the bottom of the status bar based on the time of day (either, morning, afternoon, evening or night). Then it gets the name of the user and creates a history document. The form has only two fields, a UserName field and a CreatedOn field.

    Sub Initialize
    
    Dim HistoryDoc As NotesDocument
    Dim user_name As String
    Set session = New NotesSession
    Set db = session.CurrentDatabase
    Set ws = New NotesUIWorkspace
    Set UIdoc = ws.CurrentDocument
    
    user_name = session.CommonUserName
    If Hour(Time) > 0   And Hour(Time)  < 12 Then Print 
    "Good morning " & user_name  & " and welcome back."
    If Hour(Time) > 12  And Hour(Time)  < 17 Then Print 
    "Good afternoon " & user_name  & " and welcome back."
    If Hour(Time) > 17  And Hour(Time)  < 20 Then Print 
    "Good evening  & user_name   & " and welcome back."
    If Hour(Time) > 20  And Hour(Time)  < 23 Then Print 
    "Good night " & user_name  & " and welcome back."
    
    Set HistoryDoc = New NotesDocument(db)
    HistoryDoc.Form = "FM_UserEnterDatabase"
    HistoryDoc.UserName =  user
    HistoryDoc.CreatedOn = Today
    
    Call HistoryDoc.Save(True,False)
    End Sub
  3. Place this code in the Queryclose event of the Database Script.

    Dim session As New NotesSession
    Dim user As String
    
    user = session.CommonUserName
    Print "Goodbye " & user  & " and have a nice day."

Dig Deeper on Domino Resources - Part 7

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close