Create appointment

Below is the lotusscript I used to create reminders on our users calendars when their travel requests are approved.

They can see the reminders okay, but if they try to open them they get an error “Note item not found”, then “Field ‘x’: Incorrect data type for operator or @function…”

I tried fixing the problem by adding data to the field names the errors were listing. For example the first error was on tmpEventLabel, so I put in the text “Reminder”. Worked, but then got error on StartDate_2 and so on. I took a look at the _Calendar Entry form (alias = appointment) and there are dozens of field names I’m afraid will also error out. Is there any way to create this reminder without having to put data in all those fields?

Here’s my code:

Function SendAppt

'This function sends the approved travel request to the user’s calendar

Dim session As New NotesSession

Dim ws As New NotesUIWorkspace

Dim db As NotesDatabase

Dim uidoc As NotesUIDocument

Dim doc As NotesDocument

Dim rdoc As NotesDocument

Dim view As NotesView

Dim key As String

Set db = session.CurrentDatabase

Set view = db.GetView(“Lookup By RequestID”)

Set uidoc = ws.CurrentDocument

Set doc = uidoc.Document

key = doc.RequestID(0)

Set rdoc = view.GetDocumentByKey(key)

TravelStartDate = rdoc.Ddate(0)

TravelStartTime = rdoc.Dtime(0)

Dest = rdoc.Arrival(0)

Dim userMailDb As New NotesDatabase(“”,“”)

Call userMailDb.OpenMail

Dim apptdoc As New NotesDocument(userMailDb)

apptdoc.form = “Appointment”

Call apptdoc.AppendItemValue( “_ViewIcon”,174)

apptdoc.Location = Dest

apptdoc.Subject = doc.TripObjectives(0)

apptdoc.AppointmentType= 4 apptdoc.CalendarDateTime = TravelStartDate

apptdoc.StartDateTime = TravelStartTime

apptdoc.StartDate = TravelStartDate

apptdoc.StartTime = TravelStartTime

apptdoc.EndDate = TravelStartDate

apptdoc.EndDateTime = TravelStartTime

Call apptdoc.Save(True,True)

End Function

Thank you so much for your time and input,

Kelly

Subject: Create appointment

I think if you put a:Call apptdoc.ComputeWithForm(True,False)

just before the .Save(), it will populate some internal fields with correct default values, that’s how it used to work when creating connection documents at least.

Subject: Here’s what I used, it works with no errors.

http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/b463e65f00820eaa85256f85007012b7?OpenDocument