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:

  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



  • Favorite iSeries cheat sheets

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

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury