I have been searching through the forum but there is just too much stuff that it is hard to find what you are looking for.
I have a mail database and I have created a custom form to display the incoming documents with instead of the standard Memo form. When new emails arrive there is some data I would like to prefill before the document is delivered to the user. I am creating a agent that currently runs from the menu and will eventually run on a schedule to prefill data in the email. I am finding that everything is filled in and the document does save but the documents will not display in any views until I edit and save the document. I can open the document and see that is is displaying with my custom form and that the data I wanted prefilled was visible. The views have a basic selection criteria where it selects documents based upon the alias of the form. I have attached my code which is quite common so I was wondering if anyone knows why this is happening. Thanks.
Sub Initialize
Dim db As NotesDatabase
Dim session As New NotesSession
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument
Dim j As Integer
searchFormula$ = { @Contains(Form; “Memo”:“frmVrsRequest” ) }
Set db = session.CurrentDatabase
Set collection = db.Search( searchFormula$, Nothing , 0 )
For j = 1 To collection.Count
Set doc = collection.GetNthDocument ( j )
doc.Form = “frmVRSRequest”
doc.Converted = “Yes”
doc.ReplaceItemValue “DateCreated”,doc.Created
doc.ReplaceItemValue “Associates”, “”
doc.ReplaceItemValue “EmployerName”, “”
If Instr(doc.Subject(0), “Billing”) Then
doc.ReplaceItemValue “RequestType”, “Billing”
Elseif Instr(doc.Subject(0), “Claims”) Then
doc.ReplaceItemValue “RequestType”, “Claims”
Elseif Instr(doc.Subject(0), “Conversions”) Then
doc.ReplaceItemValue “RequestType”, “Conversions”
Elseif Instr(doc.Subject(0), “CustServ”) Then
doc.ReplaceItemValue “RequestType”, “Customer Service”
Elseif Instr(doc.Subject(0), “TechAssistance”) Then
doc.ReplaceItemValue “RequestType”, “Technical Assistance”
Elseif Instr(doc.Subject(0), “Underwriting”) Then
doc.ReplaceItemValue “RequestType”, “Underwriting”
Elseif Instr(doc.Subject(0), “UserID”) Then
doc.ReplaceItemValue “RequestType”, “User ID Maintenance”
Else
doc.ReplaceItemValue “RequestType”, “Other”
End If
doc.ReplaceItemValue “Priority”, “Medium”
doc.ReplaceItemValue “HOIntervention”, “No”
doc.ReplaceItemValue “ActionTaken”, “”
If doc.Save(True, False) = False Then
Print “Document was not saved”
End If
Next
End Sub