I have a form that tracks prospective clients. When a prospective client is lost, the user enters the date that the client is lost on the form (CloseDate Field). I would like to send a reminder email to the person in charge (Orig field) 6 months from the date lost to remind them to follow up with the client (ReminderDate field using @Adjust formula to compute 6 months ahead). The following code is giving a type mismatch error. Does anyone see where the problem lies?
Thanks in advance
Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim Doc As NotesDocument
Dim db As NotesDatabase
Dim UIDoc As NotesUIDocument
Dim CurDoc As NotesDocument
Dim currdoc As NotesDocument
Dim servername As String
Dim user As String
Dim reg As New NotesRegistration
Dim regserver As String
Dim mailserver As String
Dim mailfile As String
Dim maildomain As String
Dim mailsystem As Integer
Dim profile As String
Set CurDoc = workspace.CurrentDocument.Document
Set db = session.CurrentDatabase
servername = db.Server
REM {Set mail file for user to be notified}
user = CurDoc.Notify1
reg.RegistrationServer = servername
Call reg.getUserInfo(user, mailserver, mailfile, maildomain, mailsystem, profile)
Set db = session.GetDatabase(servername,mailfile)
Set doc = db.CreateDocument
doc.form = "Appointment"
doc.AppointmentType = “4”
doc.Subject = “Follow Up Reminder for Client Lost”
doc.StartDate = CurDoc.ReminderDate
Set newDoc = New NotesDocument( db )
doc.ExcludeFromView = "D"
Set UIDoc = Workspace.EditDocument(True,doc)
Set doc = UIDoc.Document
doc.StartDate = CurDoc.ReminderDate
doc.EndDate = CurDoc.ReminderDate
doc.StartTime = CurDoc.ReminderTime
doc.EndTime = CurDoc.ReminderEndTime
Call uidoc.Reload
Hi Stephen. Thanks for the response. Yes, once I couldn’t figure out how to make the script work I started over. I’m now in the midst of ironing out another block of code to do the same thing. I don’t get any errors but the appointment isn’t appearing on the calendar. I did notice that it appear in the “Meetings” view but gives an error when you try to open it. The debugger shows several fields as text when they should be dates so I’m still working on fixing those by using CDAT…I’m not a script guru so I’m sure I’m doing a lot of this the hard way.
'Create Followup Reminder Email
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim PRIN As String
Dim Date1 As String
Dim Date2 As Variant
Dim Princ As String
Set uidoc = ws.CurrentDocument
Dim N As String
N = uidoc.FieldGetText("Notify1")
Princ = "CN=" & N & "/O=SMF"
Date1 = uidoc.FieldGetText("ReminderDate")
Date2 = Cdat(Date1)
Dim db As NotesDatabase
REM {Send Appointment Reminder to User Listed in ORIG Field
Dim Session As New NotesSession
Dim mdoc As NotesDocument
Dim db2 As New NotesDatabase("" , "")
Call db2.OpenMail
Set mdoc = db2.createdocument
mdoc.form = "Appointment"
mdoc.AppointmentType = "4"
mdoc.subject = "Followup Reminder"
mdoc.Body = "Please contact your potential client "
mdoc.StartDate = Date2
mdoc.EndDate = Date2
Dim ST As Variant
Set ST = Cdat("10:00:00 AM EDT")
mdoc.StartTime = ST
Dim ET As Variant
Set ET = Cdat("10:15:00 AM EDT")
mdoc.EndTime = ET
mdoc.Principal = Princ
mdoc.Alarms = "1"
Dim CDT As String
CDT = Cdat(Date1) & "" & Cdat("10:00 AM EDT")
mdoc.CalendarDateTime = CDT
Dim EDT As String
EDT = Cdat(Date1) & " " & Cdat("10:15 AM EDT")
mdoc.EndDateTime = EDT
mdoc.MeetingType = "1"
mdoc.SequenceNum = Cint("1")
mdoc.UpdateSeq = Cint("1")
Call mdoc.Save( False, False )