Domino Code Fragment

Code Name*
How to update a field on parent when a reponse doc has been deleted
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.18.116.40.177
Description*
It will check the documents that are being deleted and if a field exist called $Ref (which is on reponse docs) it will look at the parent and change the pro field to ""
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
The following code should be added to the Database Postdocumentdelete event.

Sub Postdocumentdelete(Source As Notesuidatabase)
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim parent As NotesDocument
Dim doc As NotesDocument
Dim parentUnid As String
For i = 1 To Source.Documents.count
Set doc = Source.Documents.GetNthDocument( i )
If doc.HasItem( "$Ref" ) Then
Set parent = db.GetDocumentByUNID( doc.ParentDocumentUNID )
parent.pro = ""
Call parent.Save( True, True )
End If
Next i
End Sub