Hi There,
i have a scheduled agent - code :
Sub Initialize
Dim s As New NotesSession
Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Dim WebDoc As NotesDocument
Dim WebDC As NotesDocumentCollection
Dim WebView As NotesView
Dim SysView As NotesView
Dim SysDoc As NotesDocument
Print "Web Call Agent - Started"
Set db = s.CurrentDatabase
Set WebView = db.GetView("WebCalls")
Set SysView = db.GetView("(SysDetailsLU)")
Set WebDC = WebView.GetAllDocumentsByKey("Index")
Set WebDoc = WebDC.GetFirstDocument
Do Until WebDoc Is Nothing
If WebDoc.SDNum(0) = "" Then
WebDoc.SDNum = GenerateSequentialNumber("FLS Call")
End If
If WebDoc.IsApp(0) = "Yes" Then
Set SysDoc = SysView.GetDocumentByKey(WebDoc.SysName(0))
WebDoc.SystemAssTo = SysDoc.SupportPersonTX(0)
WebDoc.GivenTo = SysDoc.SupportPersonTX(0)
End If
Call WebDoc.Save(True,True)
Call ServiceDeskEmail(WebDoc)
Call UserEmail(WebDoc)
Set WebDoc = WebDC.GetNextDocument(WebDoc)
Loop
Print "Web Call Agent - Finished"
End Sub
Sub UserEmail(WebDoc)
'declare variables
Dim s As New NotesSession
Dim db As NotesDatabase
Dim rtitem As NotesRichTextItem
Dim strSendTo() As String
Dim maildoc As NotesDocument
Dim strMailBlurb As String
'Set the variables
Set db = s.CurrentDatabase
Set maildoc = New NotesDocument(db)
maildoc.Form = "Memo"
Set rtitem = New NotesRichTextItem(maildoc, "Body")
strMailBlurb = WebDoc.NameList(0) &"," & Chr(13) & Chr(13) &"Thank you for contacting Clyde Union I.T. Service Desk. Your request has been received by our team and you" & _
" will be contacted within 2 working hours." & Chr(13) & Chr(13) & "Yours sincerely," & Chr(13) & Chr(13) & "Clyde Union I.T. Service Desk."
'Prepare subject and body text
maildoc.subject = "Your I.T. Service Desk Call #" & WebDoc.SDNum(0) &"."
maildoc.SendTo = WebDoc.WebEmail(0)
'Attach Link
strMailBlurb = strMailBlurb & Chr(13) & Chr(13) & "http://pmpgla8/dev/ITSD.nsf/SupportCall.xsp?documentId=" & WebDoc.Universalid & "&action=openDocument"
'maildoc.SendTo = "Jamie Grant/GB/CPL/ClydePumpsLtd"
Call rtitem.AppendText(strMailBlurb)
Call rtitem.AppendText(Chr(13) & Chr(13))
'Send Mail - Only if the description and Blurb has been filled.
If strMailBlurb = "" Then
Exit Sub
Else
'Commented out for development
maildoc.Send(False)
End If
End Sub
Sub ServiceDeskEmail(WebDoc)
'declare variables
Dim s As New NotesSession
Dim db As NotesDatabase
Dim rtitem As NotesRichTextItem
Dim doc As NotesDocument
Dim maildoc As NotesDocument
Dim strMailBlurb As String
'Set the variables
Set db = s.CurrentDatabase
Set maildoc = New NotesDocument(db)
maildoc.Form = "Memo"
Set rtitem = New NotesRichTextItem(maildoc, "Body")
strMailBlurb = WebDoc.TakenBy(0) & " has entered a service desk call and it needs to be prioritised. Please click the link below to allocate/prioritise the call." & _
Chr(13) & Chr(13) & "Yours sincerely," & Chr(13) & Chr(13) & WebDoc.TakenBy(0)
'Attach Link
strMailBlurb = strMailBlurb & Chr(13) & Chr(13) & "http://pmpgla8/dev/ITSD.nsf/SupportCall.xsp?documentId=" & WebDoc.Universalid & "&action=openDocument"
'Prepare subject and body text
maildoc.subject = " I.T. Service Desk Call #" & WebDoc.SDNum(0) &" needs to be prioritised."
'maildoc.SendTo = "Clyde Pumps IT Service Desk/GB/CPL/ClydePumpsLtd"
maildoc.SendTo = "Jamie Grant/GB/CPL/ClydePumpsLtd"
Call rtitem.AppendText(strMailBlurb)
Call rtitem.AppendText(Chr(13) & Chr(13))
'Send Mail - Only if the description and Blurb has been filled.
If strMailBlurb = "" Then
Exit Sub
Else
'Commented out for development
maildoc.Send(False)
End If
End Sub
When I schedule the agent, it returns the error : Error creating product object i have had this probolem before when connecting to Oracle databases, but i am not in this case and am completely stumpted!
Can anyone help?
thanks
Jamie