Manage Learn to apply best practices and optimize your operations.

Busytime / Chairperson Fix

When the organization moved to Lotus Notes we moved at a very rapid rate.
Information was converted and transferred from Lotus Organizer and Palm Pilots.
Many people didn't recognize the importance of the MailFile Owner in the
Calendar profile, so it was set incorrectly. Several users had their name
spelled incorrectly in their user ID and didn't mention it for several months.
Then there is always the issue of someone getting married and changing their
name. Consequently the information that had been converted and imported to
Notes and the data that was entered before the problem was corrected didn't
cause the BusyTime database to reflect timeslots as being busy when someone
would check for free time. TypeMismatch errors also would occur, because the
document was not an invitation but the CHAIR and $Busyname fields didn't match
when a document would be edited. After the TypeMismatch error the document
would be incorrectly identified as an invitation. I created this script to
correct these problems when a name
is discovered to be spelled incorrectly or has changed due to a marriage. The
script will need to be run for every incorrect name that has been used in the
database (i.e. Jennie, Jenny, Jeni) to completely correct the CHAIR field of
the document.
Sub Click (Source as Button)
'Declare some variables
Dim workspace As New NotesUIWorkspace
Dim s As New NotesSession
Dim db As Notesdatabase
Dim dbview As notesview
Dim doc As NotesDocument
Dim profile As NotesDocument 'Calendar Profile
Dim incorrectName As String 'Incorrect or Old Name for
BusyName/Chair Fields
Dim CorrectName As String 'Correct or New Name for
BusyName/Chair Fields
Dim BoxType As Long 'MessageBox Settings
Dim tmp0 As NotesItem 'Form
Dim tmp1 As notesItem 'BusyName
Dim tmp2 As NotesItem 'CalendarDateTime
Dim tmp3 As NotesItem 'Appointment Type
Dim tmp4 As notesItem 'CHAIR
Dim tmp5 As NotesItem '_ViewIcon
Dim temp As notesitem 'Profile Owner
Dim Answer As Integer

BoxType = MB_YESNOCANCEL+MB_ICONQUESTION+MB_DEFBUTTON3+MB_APPLMODAL

'Verify you are sure you want to run this script
Answer% = Messagebox(|This view will attempt to correct these entries
Do You want to Continue?|, MB_YesNO+MB_ICONQUESTION, "Continue??")
If Answer% = 7 Then End

'Set some basic variables
Set db = s.currentdatabase
Set profile = db.getProfiledocument("CalendarProfile")
Set dbview = db.getview("($All)")
Set Doc = dbview.GetFirstDocument
Set temp = profile.GetFirstItem("Owner")

'Prompt for Correct and Incorrect Names
GetMistakes:
Answer% = 0
CorrectName = Inputbox("Please enter the New or Correct Name.","Enter
Correct Name", temp.text)
IncorrectName = Inputbox(|Please enter the name the way it
was incorrectly entered before.
| ,"Incorrect Name")

'Make sure that the Calendar Profile is set correctly to prevent future
problems
If Not CorrectName = Temp.Text Then
Messagebox |You have not choosen to use the name set as the MailFile
Owner in the Calendar Profile.
To prevent this problem from happening again, Please verify that the MailFile
Owner is
set correctly in the Calendar Profile of this database and all replicas.|,
MB_OK, "Check Calendar Profile"
End If

'Make Sure that the variables are set
If CorrectName = "" Or IncorrectName = "" Then
Answer% =Messagebox(|You have not entered any information for one of
the variables in this script,
Click Yes to Continue, Click No to Re-enter data, and Cancel to End this
Script. |, BoxType, "Do you want to Continue?")
If answer% = 6 Then
answer% = 0
Elseif answer% = 7 Then
Goto GetMistakes
Else
End
End If
End If

' Make sure that the correct and incorrect are not the same thing
If IncorrectName = CorrectName Then
Answer% = Messagebox(|The name you entered for both IncorrectName and
CorrectName match.
This will prevent any changes from being applied to the Chairperson
field for these entries, Do You want to re-enter this information?
|, Boxtype , "Do You want to change your entries?")
If Answer% = 2 Then
End
Elseif Answer% = 6 Then
Goto GetMistakes
End If
End If

'Start Correcting Documents
While Not Doc Is Nothing
If Doc.hasItem("$Busyname") And Doc.HasItem("Form") And
Doc.HasItem("CalendarDateTime") Then
Set tmp0 = Doc.GetFirstItem("Form")
Set tmp1 = Doc.GetFirstItem("$BusyName")
Set tmp2 = Doc.GetFirstItem("CalendarDateTime")
If tmp0.text = "Appointment" Then
Set tmp3 =
Doc.GetFirstItem("AppointmentType")
Set tmp4 =
Doc.GetFirstItem("CHAIR")
Set tmp5 = Doc.GetF

Dig Deeper on Domino Resources - Part 2

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