Domino Code Fragment

Code Name*
Checking Validity of Pasted Documents
Date*
04/29/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.133.79.70
Description*
The following script checks to make sure the pasted document uses the correct form and passes all the form's validation formulas. If not, the document is deleted. Use this script with a view's Postpaste event.
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
Sub Postpaste(Source As Notesuiview)

Dim documents As NotesDocumentCollection
Dim doc As NotesDocument, nextdoc As NotesDocument
Dim success As Variant


Set documents = Source.Documents
Set doc = documents.GetFirstDocument
While Not ( doc Is Nothing )
Set nextdoc = documents.GetNextDocument( doc )
If Not ( doc.Form(0) = "CorrectForm" ) Then
Messagebox "Invalid form"
success = False
Else
success = doc.ComputeWithForm( False, False )
If Not ( success ) Then
Messagebox "Invalid data"
End If
End If
If Not ( success ) Then
Call doc.Remove( True )
End If
Set doc = nextdoc
Wend


End Sub