Selects those documents which are in review and have due dates which have passed. Based upon the review style of the document, it then either moves it along to the next reviewer, marks it as complete, or simply notifies the current reviewer(s) that their review is overdue.1SfL3
'++LotusScript Development Environment:2:5:(Options):0:66
Option Public
'++LotusScript Development Environment:2:5:(Forward):0:1
Declare Sub Initialize
Declare Sub SendReminder(EmailType)
Declare Function GetString(StringType)
'++LotusScript Development Environment:2:5:(Declarations):0:10
Dim session As NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim documents As NotesDocumentCollection
Dim note As NotesDocument
Dim parent As NotesDocument
Dim emaildoc As NotesDocument
Dim dt As NotesDateTime
Dim item As NotesItem
Dim rtitem As NotesRichTextItem
Dim nam As NotesName
Dim ReviewerList As Variant
Dim ReviewerNumber As Integer
Dim ReviewWindow As String
Dim NextReviewer As String
'++LotusScript Development Environment:2:2:Initialize:1:10
Sub Initialize
%REM
changes:
ReviewerNumber is 1 based so when Reviewer 1 is reviewing ReviewerNumber = 1.
Therefore, using a 0 based array, NextReviewer = ReviewerList(ReviewerNumber)
send the message
increment next reviewer if necessary
%END REM
'While this is similar to the same agent in doclib4, it is slightly different. The differences are commented
Set session = New NotesSession
Set db = session.CurrentDatabase
Set documents = db.Search("@Today => @Date(DueDateTime) & Status = 2", Nothing, 0)
If documents.Count = 0 Then Exit Sub
For d = 1 To documents.Count
Set note = documents.GetNthDocument(d)
ReviewWindow = note.ReviewWindow(0)
ReviewerList = note.ReviewerList
ReviewerNumber = note.ReviewerNumber(0)
Set dt = New NotesDateTime(note.DueDateTime(0))
Set nam = New NotesName(note.From(0))
'ReviewWindow in the Web version has values of 0 (no time limit), 1 (move to next reviewer), and 2 (send notification)
Select Case ReviewWindow
Case "1" 'Move to next reviewer
SendReminder("WindowExpired")
If ReviewerNumber <= Ubound(ReviewerList) Then
SendReminder("NotifyNextReviewer")
Else
SendReminder("NotifyOriginator")
note.Status = 3
End If
note.ReviewerNumber = ReviewerNumber + 1
Case "2" 'Send notification to current reviewer
SendReminder("Reminder")
End Select
If note.IsResponse Then note.RemoveItem("DueDateTime")
note.Save True, True, True
Next
End Sub
'++LotusScript Development Environment:2:2:SendReminder:1:8
Sub SendReminder(EmailType)
If note.IsResponse Then Exit Sub
Set maildoc = New NotesDocument(db)
Set rtitem = New NotesRichTextItem(maildoc, "Body")
maildoc.InheritedSubject = note.Subject
maildoc.InheritedDbTitle = db.Title
Select Case EmailType
Case "Reminder"
maildoc.SendTo = ReviewerList(ReviewerNumber - 1)
maildoc.Subject = GetString(1)
rtitem.AppendText(GetString(2))
Call rtitem.AppendDocLink(note, GetString(3))
Case "WindowExpired"
maildoc.SendTo = ReviewerList(ReviewerNumber - 1)
maildoc.Subject = GetString(4)
rtitem.AppendText(GetString(5))
Call rtitem.AppendDocLink(note, GetString(3))
'reset the due date
Set dt = New NotesDateTime("")
dt.SetNow
ReviewTime = note.ReviewTime(0)
If Isnumeric(ReviewTime) Then
dt.AdjustDay(ReviewTime)
Set note.DueDateTime = dt
End If
Case "NotifyNextReviewer"
maildoc.SendTo = ReviewerList(ReviewerNumber)
maildoc.Subject = GetString(6)
rtitem.AppendText(GetString(7))
Call rtitem.AppendDocLink(note, GetString(8))
Case "NotifyOriginator"
maildoc.SendTo = note.From
maildoc.Subject = GetString(9)
rtitem.AppendText(GetString(10))
Call rtitem.AppendDocLink(note, GetString(8))
End Select
maildoc.Form = "Memo"
On Error Resume Next
Call maildoc.Send (False)
End Sub
'++LotusScript Development Environment:2:1:GetString:1:8
Function GetString(StringType)
Select Case StringType
Case 1 'Subject of a reminder email
GetString = "Overdue Document Review"
Case 2 'Body of a reminder email
GetString = "Your review of the document entitled " & note.Subject(0) & " was due on " & dt.DateOnly &_
". Please review the document and mark it as complete, because you will continue to receive these notifications until you do so. "
Case 3 'comment for the AppendDocLink method
GetString = "DocLink to Overdue Document"
Case 4 'Subject of WindowExpired email
GetString = "Document Review Period has Expired"
Case 5 'Body of a expired email
GetString = "The time limit for your review of the document entitled " & note.Subject(0) & " expired on " & dt.DateOnly & ". "
Case 6 'Subject for email notifying next reviewer that they need to review this
GetString = "Document Requires Review"
Case 7 'Body of email to ntes reviewer
GetString = nam.Common & " would like you to review the document entitled " & note.Subject(0) & " before " & dt.DateOnly & ". "
Case 8 'comment for the AppendDocLink method
GetString = "DocLink to Document requiring review"
Case 9 'Subject on email to originator
GetString = "Document Review is Complete"
Case 10 'Body of expired email to originator
GetString = "The time limit for the review of the document entitled " & note.Subject(0) & " expired on " & dt.DateOnly & ". "
End Select
End Function
\ \ \
O=Lotus Notes
O=Lotus Notes
PURSAFO
|.:#U
O=Lotus Notes
CN=Lotus Notes Template Development/O=Lotus Notes
PURSAFO
Fde!f^^
$TITLE
$AssistType
$AssistLastRun
$AssistDocCount
$Comment
$AssistFlags
$AssistTrigger
$AssistInfo
$AssistQuery
$AssistAction
$AssistAction_Ex
O=Lotus Notes
O=Lotus Notes
PURSAFO
|.:#U
O=Lotus Notes
CN=Lotus Notes Template Development/O=Lotus Notes
PURSAFO
Fde!f^^
sZ%!ZM}
$Flags
Times New Roman
bullet
/All?OpenView
(Return to All Documents View)
T !hA
!ATA!T!TJ3U
&XKBU
C'UBK#JThT
J#9#9
[$U%U>L
MLUB&B%
B4B4%
4BKB^U4B&K
f#fKf
NVM$B&K
TJZ9J=J9E
NCML>^4UL
U%BKelg
AbA!T!T
K&KJ
hKeK3K&J
cf%K#J J
N*MLUB
K9J#Kh
= JT!TJ9J]JKf
$U4>_g
L>B3XU>
gN(L4B3K
J9J&L
4B3B4
fUB&l
M5L>:5
fC5:C
$U4ULT
B&3BL
C:>U:B
l+`:U&393Z3ZJT!
=J=]=
'UB3&B$
(_%^>L
M:U4^>:
= J ]
=TATA
LU%U'
V[$U>_5
gN6:>_5ND
m"P8;*:U3KZ
CLUlU
VMLU^_5c
U >:UM
6M:>U
?`':L5J
D8-DON*Y':[
C'L>Lf
+C5[:5L
h7VML$56C
Ck$Ui%
k$>$Mf
O65L:56
DNC:U%_:M
MLU>:%
T!T!T!T
J T=
q8;VM(
eD,D8P
C)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T
JK^U>
K3B4U>
MC6`*6C
5M:LS
U>UL:5
>4B9J
JeU$L
>U3K#K
K 9 J
%BeK#KJK&BU>
%U4U2
K3X&B^
T!T!T
!TJ34U%U>SU4XB
>:M5M:
4BX&3
=J=J]=
3#g=J9
#KJK3K
4 U>4B&3&3B
X3BFB4U
J9K9K3K3&
#fKfK
J] hA
XB4U4B&3K
]JK3BXB
K 3B43BX3KX
X43KJ
T TJ=
JZ39J
T!T9
3439K
BF3K9J
=J#K9J9Z3
J9Z3K9K
#K39Z
=JT T
!hThT
h!ThT
K9]J]
9]!hTJ9Z9J
hA!h!h
TJ JT
AbAb
!TAh!T
bAbAbAb
T=]JT
s{{kss{
k{{cssZkk
ks{cks
ss{{{
Using Document Library
This database allows you to capture and track information about documents.
Functions of the Database:
To add a document to this database
Click the New Document action from any of the views.
To respond to a document
Open a document, then click the Response action. From a Notes Client, you can also highlight that document in a view, then click Response from there. For Notes Client users, this creates a response to the main document in the thread. For browser clients, this creates a response to the current document.
To respond to a response
From a Notes Client, highlight the response you wish to respond to, then click Response to Response. This function is performed from a browser by using the Response action, as described above.
To flag a document as Private:
You can use the "Mark Private" and
"Mark Public" actions in the template to control whether anyone other than yourself can read a specific document. For example, if you have not completed the writing of a particular document, you can click the "Mark Private" action and others will not be able to see the document. When you complete the document, you can click the
"Mark Public"
action to make it available for others to read. If a document is marked private after it has been submitted for review, the document author and the reviewers will be able to read the document.
ACL Settings
This application was designed with the intention that all users, except the manager, should have Author access. If they have editor access, the review cycle may not function correctly. Anonymous access is also not permitted.
Features
Document Review Cycle:
The author of a document has the option of setting up a document review cycle for that document. To do so simply click on the Setup Review Cycle link and fill in the necessary information.
Note:
Do not use
@Domain
when entering approver names. Any domain added will be stripped off and may cause complications when attempting to route a request. Also, only enter Person-names as approvers. Group names are not supported.
Processing Late Reviews:
If the Process Late Reviews agent is enabled, it selects those documents which are in review and have due dates which have passed. Based on the time limit options chosen by the originator, it then either moves it along to the next reviewer, marks it as complete, or simply notifies the current reviewer that the review is overdue.
Document Archiving:
This is a process by which certain documents are removed from the current database and stored in a different database. This keeps the document library up-to-date with only the latest topics. Most of the Archiving activities take place from the "Archiving" view. You must switch to this view in order to initiate archiving on a document library database.
To set up archiving on any document library database, switch to the Archiving view and click the action called "Setup Archive". The Archive Profile appears. This document contains criteria that the user specifies for archiving topics in a document library (e.g., inactive after 'x' days, or expired after 'x' days). The archive database is automatically created when the Profile is saved. The archival database filename is also specified in the Archive Profile; the title of the archive will be the title of the Document Library database followed by "(Archived)". After the archive criteria have been specified in the Archive Profile, other agents run on the database to move the document(s).
Mark/Unmark Document as Expired:
Marks a topic as "expired".
If the Archive Profile specifies that
expired
topics should be archived, the document(s) marked with this agent would fall into that criterion. If a document is already marked as expired, this agent tells the user what the expire date was, and will ask if the user wants to un-expire it.
Periodic Archive:
Reviews the Archive Profile and moves documents which meet the archive criteria into the archive database. This agent is run automatically on the server; the schedule is set by the database manager/designer.
A Document Library application is an electronic filing cabinet that stores reference documents for access by a workgroup. The database might contain anything from environmental impact statements for a group of engineers to financial statements for a group of loan officers.
Who will use this database?
Anyone who wishes to create a record of a document or review available documents may use this database.
Important Features
Web or Notes client:
Database can be accessed from either a Web browser or a Notes Client.
Review Cycle:
Used to route a document to a series of recipients.
Document Archiving:
Used to move expired documents to an archive database.
Suggestions for Modifications
Full text search:
If you wish to use Notes' full text search capabilities for a database created with this template, select menu File, Database, Properties, go to the Full Text panel and then select Create Index... to create the full text index.
Where to find more information?
More information can be found in the
Notes
/$Help?OpenHelp
3S4S6S11S21S
Using This Database
document, or refer to the following documentation database on http://www.notes.net: Best Practices: Templates and Sample Databases (BPTEMP.NSF)
Access Control
Very Important:
Access level should be
Author
for all users of this database. This will prevent unauthorized editing of documents within the database. The Author fields within the forms govern who will be able to edit/review particular documents. Errors will occur if someone with Editor access attempts to review a document when they are not an authorized reviewer of that document. For those accessing the database from a Web browser, the database does not accept Anonymous users.
O=Lotus Notes
O=Lotus Notes
PURSAFO
|.:#U
O=Lotus Notes
CN=Lotus Notes Template Development/O=Lotus Notes
PURSAFO
Fde!f^^
$Info
$Body
'++LotusScript Development Environment:2:5:(Options):0:74
Option Public
Option Explicit
Use "SubmitForReview"
'++LotusScript Development Environment:2:5:(Forward):0:1
Declare Sub Initialize
'++LotusScript Development Environment:2:5:(Declarations):0:2
'++LotusScript Development Environment:2:2:Initialize:1:10
Sub Initialize
'logging is for debug purposes
Set dbug = New NotesLog("SubmitDocument")
'to turn off the debug log, set this to False
dbug.LogActions = True
dbug.OpenAgentLog
On Error Goto StandardError
Set session = New NotesSession
Set db = session.CurrentDatabase
DbName = getdbpath
Set note = session.DocumentContext
If note.Form(0) <> "Document" Then Goto ExitWithoutSend
If note.HasItem("SaveOnly") Then
note.RemoveItem("SaveOnly")
Exit Sub
End If
If note.SubmitNow(0) = "1" Then SubmitNow = True
'If we are not submitting for review, we don't need to do the rest of this
If (Not(SubmitNow) Or note.Status(0) = 3) And note.Resubmit(0) = "0" Then Goto ExitWithoutSend
'Validate the Originator is not in the ReviewerList
If ListIncludesOriginator Then
ErrorText = GetString(17)
Goto ValidationError
End If
'Validate that ReviewTime has a valid entry if ReviewWindow is not 0
Set item = note.GetFirstItem("ReviewTime")
If note.ReviewWindow(0) <> "0" Then
Dim InvalidReviewTime As Integer
'This verifies that it is not 0 or blank or a string
If item.Text = "" Or item.Text = "0" Or item.Text Like "*ERROR*" Then
InvalidReviewTime = True
'This verifies that it is a whole number > 0
Elseif note.ReviewTime(0) < 1 Or Int(note.ReviewTime(0)) <> note.ReviewTime(0) Then
InvalidReviewTime = True
End If
If InvalidReviewTime Then
FieldName = "Time Limit"
ErrorText = GetString(16)
Goto ValidationError
End If
End If
'Validate that ReviewerList is not empty
If note.ReviewerList(0) = "" Then
FieldName = "Reviewer List"
ErrorText = GetString(19)
Goto ValidationError
End If
SendToNext 'in scriptlib SubmitForReview
Exit Sub
ExitWithoutSend: 'You submitted the form but were not sending anything to anyone
Print "<h3>" & GetString(9) & "</h3>"
Goto ViewLinks
StandardError: 'This is for errors which we are not specifically handling
'++LotusScript Development Environment:2:5:(Options):0:74
Option Public
Option Explicit
Option Compare Nocase
'++LotusScript Development Environment:2:5:(Forward):0:1
Declare Function GetString(StringType)
Declare Function SendToNext
Declare Function ListIncludesOriginator
Declare Function GetDBPath
'++LotusScript Development Environment:2:5:(Declarations):0:10
Dim session As NotesSession
Dim db As NotesDatabase
Dim note As NotesDocument
Dim mailnote As NotesDocument
Dim savenote As NotesDocument
Dim rtitem As NotesRichTextItem
Dim item As NotesItem
Dim dbug As NotesLog
Dim username As NotesName
Dim fromname As NotesName
Dim sendtoName As NotesName
Dim reviewername As NotesName
Dim dt As NotesDateTime
Dim ReviewerNumber, TotalReviewers, Position, SubmitNow, IsCurrentReviewer As Integer
Dim ReviewerList, ReviewTime As Variant
Dim NextReviewer, DbName, ViewList, NotificationType, ClientType, FieldName, ErrorText As String
'++LotusScript Development Environment:2:1:GetString:1:8
Function GetString(StringType)
Select Case StringType
Case 1 'Subject of the original copy of the document
GetString = "Original Copy: " & note.Subject(0)
Case 2 'Subject of the final reviewer email stating that all reviewers have completed their review
GetString = "Review is complete for the document entitled: " & note.Subject(0)
Case 3 'Subject of email informing a reviewer that they need to review this doc
GetString = fromname.Common & " would like you to review the document entitled: " & note.Subject(0)
Case 4 'First line of acknowledgement page, informing user that email was successfully sent to originator
GetString = sendtoname.Common & " has been notified that review of this document is complete"
Case 5 'First line of acknowledgement page, informing user that email was successfully sent to next reviewer
GetString = sendtoname.Common & " has been notified that this document requires review"
Case 6 'Line in Reviewer Log stating when the doc was submitted for review by the originator
GetString = "Submitted for review on " & Today
Case 7 'Line in Reviewer Log stating that a particular reviewer has been skipped
'GetString = ReviewerList(ReviewerNumber - 1) & " was skipped over by " & username.Common & " on " & Today
GetString = reviewername.Common & " was skipped over by " & username.Common & " on " & Today
Case 8 'Line in Reviewer Log stating when a particular reviewer completed their review
GetString = "Review completed by " & username.Common & " on " & Today
Case 9 'User submitted form but did not indicate that they needed to send anything
GetString = "Document has been saved"
Case 10 'Text for the Body field of the notification email
GetString = "Click on this link to access the document. "
Case 11 'Text associated with the AppendDocLink method
GetString = db.Title & ", " & note.Subject(0)
Case 12 'An error that we are not specifically handling
GetString = Err & " - " & Error
Case 13 'First line on the acknowledgment page when there was an error sending the document
GetString = "Error sending review notification to " & sendtoName.Common
Case 14 '1st string in the second line on the acknowledgement page when there was an error sending the document
'(the string says "Return to Document, fix the whatever, and resubmit" and Return to Document is a link back to the doc"
GetString = "Please click here to return to the document"
Case 15 '2nd string in the second line on the acknowledgement page when there was a validation or send error
GetString = ", fix the " & FieldName & ", and resubmit."
Case 16 '1st line of Error if user entered a ReviewWindow but no ReviewTime
GetString = "You indicated what should happen when the time limit expires but you did not indicate a valid Time Limit (a whole number greater than 0). "
Case 17 '1st line of Error if originator included themself in the reviewer list
GetString = "The document's originator cannot be included in the reviewer list. "
Case 18 'messagebox text for validation errors
GetString = "Please enter a valid " & FieldName & "."
Case 19 'User indicated submit for review but didn't enter any reviewers
GetString = "You did not indicate who should review this document."
Case 30 '30-33 are the names of views you can go to from the submitted page
GetString = "All Documents"
Case 31 '30-33 are the names of views you can go to from the submitted page
GetString = "By Author"
Case 32 '30-33 are the names of views you can go to from the submitted page
GetString = "Review Status"
Case 33 '30-33 are the names of views you can go to from the submitted page
GetString = "By Category"
Case 40 'Title bar for messageboxes (Notes client only)
GetString = "Document Library"
Case 41 'Title bar for error messageboxes (Notes client only)
GetString = "Document Library - Error"
End Select
End Function
'++LotusScript Development Environment:2:1:SendToNext:1:8
Function SendToNext
If Not(dbug Is Nothing) Then dbug.LogAction("SendToNext")
SendToNext = True
On Error Goto StandardError
Set mailnote = New NotesDocument(db)
ReviewerList = note.ReviewerList
TotalReviewers = Ubound(ReviewerList)
Set username = New NotesName(note.CurrentUser(0))
Set reviewername = New NotesName(note.CurrentEditor(0))
Set fromname = New NotesName(note.From(0))
If Lcase(username.Common) = Lcase(reviewername.Common) Then IsCurrentReviewer = True
'Statuses: 1=New, 2=In Review, 3=Review Complete
If note.Status(0) = 1 Then
'savenote is a copy of the original which we save as a response to the copy that will be reviewed
If Not(note.HasItem("OriginalSaved")) Then
note.save True, True, True
Set savenote = New NotesDocument(db)
Call note.CopyAllItems(savenote, False)
'from the Notes client, the body field is not available to note until a ui save
If note.HasItem("Body") Then
Set rtitem = note.GetFirstItem("Body")
savenote.RemoveItem("Body")
Call rtitem.CopyItemToDocument(savenote, "Body")
Else
note.CopyBody = True
End If
Call savenote.MakeResponse(note)
savenote.~$RefOptions = "1"
savenote.Subject = GetString(1)
savenote.save True, True, True
note.OriginalSaved = savenote.UniversalId
End If
'if we are skipping the first reviewer on the initial send, we need to increment the reviewernumber
If note.Resubmit(0) = "2" Then
ReviewerNumber = 1
note.ReviewerNumber = 1
Else
ReviewerNumber = 0
note.ReviewerNumber = 0
End If
Else
ReviewerNumber = note.ReviewerNumber(0)
End If
'in this case we are resubmitting after a successful send so we decrement the ReviewerNumber
If note.Resubmit(0) = "1" And Not(note.HasItem("SendError")) Then
ReviewerNumber = ReviewerNumber - 1
'in this case we are skipping this person and sending notification to the next person
Elseif note.Resubmit(0) = "2" And IsCurrentReviewer Then
ReviewerNumber = ReviewerNumber + 1
End If
'in this case I am the last person in the reviewer list
If ReviewerNumber > TotalReviewers Then
mailnote.SendTo = note.From
mailnote.Subject = GetString(2)
NotificationType = "complete"
Gosub SendMail
note.Status = 3
note.RemoveItem("DocAuthors")
Else
NotificationType = "review"
'if this is a resubmit, you might have entered something new in the NewReviewer field, so we need to put that in ReviewerList