Sub Postsave(Source As Notesuidocument)
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim newdb As NotesDatabase
Dim doc As NotesDocument
Dim maildoc As NotesDocument
Dim mailrtitem As NotesRichTextItem
Dim language As String, docket As String, fname As String, lname As String, interveiwer As String, notify As String
Dim Comments As String
Dim intdate As Variant
Set db = session.CurrentDatabase
Set servername = New NotesName(db.Server)
'Check organization of Requestor to know which domain to send to
domainmailfile = "mail.box"
Set newdb = session.GetDatabase(servername.Abbreviated, domainmailfile)
Set maildoc = New NotesDocument(newdb)
Set doc = source.Document
If (source.FieldGetText("InterviewLanguage") = "Other" And source.FieldGetText("OtherLanguage") <> "") Then
'set admin personnel to receive notification
Dim recipients( 1 To 2 ) As String
recipients( 1 ) = "Barbara Giannini"
recipients( 2 ) = "Bernadette Peck"
If source.document.IsNewNote Then
language = source.FieldGetText("OtherLanguage")
docket = source.FieldGetText("DocketNo")
fname = source.FieldGetText("FirstName")
lname = source.FieldGetText("LastName")
intdate = source.FieldGetText("InterviewDate")
interviewer = source.FieldGetText("Interviewer")
maildoc.Form = "Memo"
maildoc.Subject = "Translator Needed"
maildoc.Body = "Case Number: " + docket + ". " + fname + " " + lname + " , interviewed on " + intdate + " by " + interviewer + ", requires a " + language + " translator. Thank you."
Call maildoc.Send( False, recipients )
Else
Exit Sub
End If
End If
If (source.FieldGetText("NoReleased") <> "--No Selection" And source.FieldGetText("Release") = "Not Released" And source.FieldGetText("Comments") <> "") Then
'set pretrial supervisors to receive notification with DOCUMENT LINK
Dim recipients2 As String
recipients2 = "Robert Padilla"
If source.document.IsNewNote Then
Comments = source.FieldGetText("Comments")
docket = source.FieldGetText("DocketNo")
fname = source.FieldGetText("FirstName")
lname = source.FieldGetText("LastName")
intdate = source.FieldGetText("InterviewDate")
interviewer = source.FieldGetText("Interviewer")
maildoc.Form = "Memo"
maildoc.Subject = "Supervisor Non-Release Review"
Set mailrtitem = maildoc.CreateRichTextItem("Body")
Call mailrtitem.AppendText ("Case Number: " + docket + ". " + fname + " " + lname + " , interviewed on " + intdate + " by " + interviewer + ", was not released. Here are the comments "_
+ interviewer + " wrote: " + Comments + " ")
Call mailrtitem.AppendDocLink(doc, "")
Call maildoc.Send( False, recipients2 )
Else
Exit Sub
End If
End If
If (source.FieldGetText("Treatment") = "New") Then
'set pretrial supervisors to receive notification with DOCUMENT LINK
Dim recipients3( 1 To 3 ) As String
recipients3( 1 ) = "Edwina Abeyta"
recipients3( 2 ) = "Peter Boyles"
recipients3( 3 ) = "David Martinez"
If source.document.IsNewNote Then
docket = source.FieldGetText("DocketNo")
fname = source.FieldGetText("FirstName")
lname = source.FieldGetText("LastName")
intdate = source.FieldGetText("InterviewDate")
interviewer = source.FieldGetText("Interviewer")
maildoc.Form = "Memo"
maildoc.Subject = "PTS Interview with Treatment"
Set mailrtitem = maildoc.CreateRichTextItem("Body")
Call mailrtitem.AppendText ("Case Number: " + docket + ". " + fname + " " + lname + " , interviewed on " + intdate + " by " + interviewer + ", has mental health issues. ")
Call mailrtitem.AppendDocLink(doc, "")
Call maildoc.Send( False, recipients3 )
Else
Exit Sub
End If
End If
Set doc = workspace.currentdocument.document
If doc.IsNewNote Then
Dim endTime As New NotesDateTime( "" )
Dim intend As String
endTime.LSLocalTime = Now
intend = endtime.TimeOnly
Call source.FieldSetText("EndTime", intend)
End If
End Sub