Force Backend Scripts?

Hello All - I have an agent that creates a reminder in the curent users calendar just like I want it to. the client can open the document in read mode, but when the user tries to delete the reminder , an error pops that says “Error trying to open document: Type mismatch”.

Although the doc can be opened and saved, then deleted without the error. Is there any way to display exactly why this error displays or is there a way to force the back end scripts to avoid trhe error?

Sub Initialize

Dim dateTime As notesDateTime, popUpStr As String, subjectStr As String	

Dim sess As New NotesSession

Dim ws As New notesuiworkspace

Set uidoc = ws.currentdocument

Set doc=uidoc.document	

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

Call userMailDb.OpenMail

Dim user As String

user = sess.CommonUserName	



Dim reminderDoc As New NotesDocument( userMailDb )



Dim DTItem As NotesItem



With reminderDoc

	

	.Form = "Appointment"

	.ReplaceItemValue "$Alarm", 1

	.ReplaceItemValue "$AlarmDescription", popUpStr

	.ReplaceItemValue "$AlarmMemoOptions", ""

	.ReplaceItemValue "$AlarmOffset", 0

	.ReplaceItemValue "$AlarmUnit", "M"

	.ReplaceItemValue "$BorderColor", "D2DCDC"

	.ReplaceItemValue "Categories", "Paid Time Off (PTO)"

	.ReplaceItemValue "_ViewIcon", 10			

	.ReplaceItemValue "ExcludeFromView", "D" 

	.Subject = user

	.Alarms = "1"

	.tmpEventLabel = "Reminder"

	.tmpChair = user

	.StartDateTime = doc.PVFrom   'Cdat("02/01/2007 07:00:00 AM")'  

	.StartDate = doc.PVFrom  'Cdat("05/13/2003")

	.EndDateTime = doc.PVTo    'Cdat("05/13/2003 07:00:00 AM")

	.EndDate = doc.PVTo     'Cdat("05/13/2003")

	.EndDate_2 = doc.PVTo     'Cdat("05/13/2003")

	.StartTime = Cdat("07:00:00 AM")

	.EndTime = Cdat("07:01:00 AM")

	.Location = "Out Of Office"

	

	.Body = doc.PVRequestText_C  

	.BookFreeTime = ""

	.CalendarDateTime = doc.PVFrom  'Cdat("05/13/2003 07:00:00 AM")

	

	.AppointmentType = 4

	

	.ComputeWithForm False, False

	.Save True, False

	

	.PutInFolder( "$Alarms" )

	

	Dim msg As String

	msg = "An entry has been made in your calendar for this PV Request."

	Messagebox msg, MB_OK, "Request Submitted - Reminder Created"

	

End With

End Sub

Subject: Force Backend Scripts?

You need to do some work in the querydocumentdelete event to find out what is raising the error.

Subject: RE: Force Backend Scripts?

The querydocument delete is in the clients mailfile. I can’t touch that. If I opn the reminder and save it, I can delete it with no problem. I was wondering if I can for the same save event processes in my script to avoid the eror message.

Subject: RE: Force Backend Scripts?

I don’t mean to say that you should modify it - just walk through it in the debugger so you can see WHY it errors out.

Subject: Force Backend Scripts?

Have you tried deleting the document with the debugger on?

The error indicates a field is not set properly.

Do you get the same error message if YOU try to delete the message from the User’s mail file?

Subject: RE: Force Backend Scripts?

With the debugger on, when I delete the document using the delete key, I get the error msg, but the debugger doesn’t fo through its iteration. The mail doc is a company standardized version. I know there is more that goes on during a manual reminder creation. My script is missing those updates in the recalc and save events of the reminder. is there any way to force them?

Subject: RE: Force Backend Scripts?

@Command([ViewRefreshFields]), NotesUIDocument.Refresh, or NotesDocument.ComputeWithForm(True, True) … all of those will force all formulas to recalculate.