Document review "Sign-Off" button

- allows users to sign-off on a document by pressing a button. - When the user signs-off on the docuement, their name is removed from one field and transferred to another with a timestamp. - Automatic emails are being generate to all users listed in the first field, thus once removed, the user will no longer receive emails.

Sub Click(Source As Button)
	Dim workspace As New NotesUIWorkspace
	Dim session As New NotesSession
	Dim uidoc As NotesUIDocument
	Dim doc As notesdocument
	Set uidoc = workspace.CurrentDocument
	Set doc = uidoc.document
	Dim User As String
	Dim J As Integer
	Dim X As Integer
	User = session.commonusername
	'Check If the user has signed-off already
	Dim item As NotesItem
	Set item = doc.GetFirstItem( "TargetEmail" )
	If item.Contains(Trim(Cstr(User))) Then
		If uidoc.editmode = False Then
			uidoc.EditMode = True
		End If
	     'Gather Info from original targetemail field
		Dim targetarray() As String
		Redim targetarray(0 To Ubound(doc.TargetEmail)) As String
		For J = 0 To Ubound(doc.TargetEmail)
			TargetArray(J) = doc.TargetEmail(J)		
		Next J
          'Blank out targetemail field
		doc.TargetEmail = ""
	     'Repopulate targetemail field
		For x = 0 To Ubound(targetarray)
			If Not User = Cstr(TargetArray(x)) Then
				If doc.TargetEmail(0) = "" Then
					doc.TargetEmail = TargetArray(x)	
					Set item = doc.GetFirstItem( "TargetEmail" )
					Call item.AppendToTextList(Cstr(TargetArray(x)))
				End If	
			End If
		Next x
		Dim newitem As NotesItem
		Set newitem = doc.GetFirstItem("SignedOff")
		Call newitem.AppendToTextList(Cstr(User & " on " & Now))
		Call uidoc.Save
		Call uidoc.close
	End If
End Sub

Posted by fbrefere001 on Tuesday February 5, 2002