Reminder Alarm notification doesn't work - code enlosed

I have a client database and I am trying to set a reminder for client next call. In contact records there are two date/time fields - NextCall (date) and CallTime (time). There is a button “Remind me” with the action below.

I do not get any errors but nither the calendar entry is created nor the document is placed in Alarm folder.

Any idea why this doesn’t work?

Thanks!

Sub Click(Source As Button)

Dim s As NotesSession

Dim uiw As NotesUIWorkspace

Dim uidoc As NotesUIDocument

Dim mailnote As NotesDocument

Dim mailDB As New NotesDatabase("","")

Dim thisDB As NotesDatabase

Dim dateitem As NotesItem

Dim timeitem As NotesItem

Dim success As Variant

Dim profile As NotesDocument



Set s=New NotesSession

Set uiw=New NotesUIWorkspace

Set uidoc=uiw.CurrentDocument

Set thisDB = s.CurrentDatabase

Set doc = uidoc.Document

Set mailDB = New NotesDatabase ("","") 

mailDB.OpenMail

Set profile = mailDB.GetProfileDocument("CalendarProfile") 'find users calendar profile

If profile.EnableAlarms(0) < "1" Then ' check to see if alarms are enabled

	Dim boxType As Long

	boxType& = MB_YESNO + MB_ICONQUESTION

	If Messagebox("You have not enabled alarms in your Calendar Profile. Do you want to enable them now?", boxType&, "Enable Alarms?") = 6 Then

		uiw.EnableAlarms(True)

		Call profile.ReplaceItemValue("EnableAlarms", "1")

		Call profile.Save(True,True,True)

	End If

End If

Set mailnote = New NotesDocument(mailDB)

mailnote.Form="Appointment"

mailnote.AppointmentType="4" 'reminder

mailnote.Subject="Reminder - Call" + " " +doc.first_name(0)+" "+doc.last_name(0)+" - "+doc.company(0)

mailnote.StartDate=doc.NextCall(0)

mailnote.StartTime=doc.CallTime(0)

mailnote.ExcludeFromView="D" 'ensures it doesn't appear in drafts view

mailnote.RemoveItem("$AlarmOffset")



Set dateitem = doc.GetFirstItem("NextCall")

Set timeitem = doc.GetFirstItem("CallTime")



Set AlarmTime = New NotesDateTime(dateitem.DateTimeValue.DateOnly & " " & timeitem.DateTimeValue.TimeOnly)

Call mailnote.ReplaceItemValue("$AlarmTime", AlarmTime.LSLocalTime)

Call mailnote.ReplaceItemValue("$NoPurge", AlarmTime.LSLocalTime)

Call mailnote.ReplaceItemValue("$AlarmDescription" , mailnote.Subject)

mailnote.StartDateTime=AlarmTime.LSLocalTime

mailnote.ReminderTime=AlarmTime.LSLocalTime

mailnote.EndDateTime=AlarmTime.LSLocalTime

mailnote.CalendarDateTime=AlarmTime.LSLocalTime

mailnote.BookFreeTime="1"

mailnote.CHAIR=s.UserName

mailnote.ORGDONTDOUBLEBOOK=""

mailnote.ORGTABLE="C0"

mailnote.PRINCIPAL=s.UserName

mailnote.tmpApptFlags=""

Call mailnote.ReplaceItemValue("_ViewIcon" , 10)

Call mailnote.ReplaceItemValue("$Alarm" , 1)

Call mailnote.ReplaceItemValue("$BusyPriority" , "2")

Call mailnote.ReplaceItemValue("$PublicAccess" , "1")

Call mailnote.ReplaceItemValue("$BusyName" , s.UserName)

Call mailnote.ReplaceItemValue("$PrevBusyName" , s.UserName)

success=mailnote.ComputeWithForm(False, False)

If success Then

	Call mailnote.Save(False, False)

	Call mailnote.PutInFolder("$Alarms") 'needs to be in this folder to allow the alarms agent to run on it

End If

Call uidoc.Refresh

Print "Calendar alarm created....."

Dim msg As String

msg = "Alarm Created for " & AlarmTime.LSLocalTime

Messagebox msg, MB_OK, "Calendar"

End Sub

Subject: Reminder Alarm notification doesn’t work - code enlosed

Can it be because success=mailnote.ComputeWithForm(False, False) returns false?

Subject: RE: Reminder Alarm notification doesn’t work - code enlosed

Yes, exacty that. It returns false and when I removed that inquiry everything started to work. The problem is that ComputeWithForm finds the validation failure but I could not find the reason for that.

Subject: RE: Reminder Alarm notification doesn’t work - code enlosed

It’s most probably datatype error (e.g. text instead of number). It’s not always easy to find the field cause the error. You can locate the field by removing fields one by one until it works.