Manage Learn to apply best practices and optimize your operations.

Prevent Deletion Of Parent Documents

The following script contains exerpts from many different scripts that I found
on preventing the deletion of documents - plus some of my own. If you want to
ensure individuals don't delete a parent document that has response documents
linked to it, the following script will do that. It forces them to delete all
responses before they can delete the parent. That helps eliminate the problem
of individuals deleting a parent document and then coming back to the developer
to find out why additional documents disappeared.
Place the following script in the Querydocumentdelete of the Database Script:

Sub Querydocumentdelete(Source As Notesuidatabase, Continue As Variant)
Dim session As New notessession
Dim db As notesdatabase
Dim doc As notesdocument
Dim response As NotesDocument
Dim coll As NotesDocumentCollection
Dim collection As NotesDocumentCollection
Dim Flag As Integer
Dim collection_count As Integer

Flag = 0
Set db = Source.database
Set coll = Source.documents 'Collects only the documents marked for
deletion

For i = 1 To coll.count
Set doc = coll.getnthdocument(i)
Set collection = doc.Responses
collection_count = collection.count

If collection_count = 0 Then
Else
Flag = Flag + 1
End If

Next

If FLAG <> 0 Then
Continue = False
Msgbox FLAG & " out of " & coll.count & " documents you have marked
for deletion have documents linked to them." & Cr & " Please delete all linked
documents and try again.",54,"Deletion Process Terminated"
End If

End Sub

Dig Deeper on Domino Resources - Part 7

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close