Link to home
Start Free TrialLog in
Avatar of varvoura
varvoura

asked on

orphand response docs

Hi all,

I have a response hierarchy in one of my databases. Now while testing I have noticed that when I delete the parent document, all other response and response to response documents linked to that deleted parent remain the database. Is there a way that I can make sure that when a main document is deleted its responses and responses to responses are also deleted?

Thank you
Varvoura
SOLUTION
Avatar of madheeswar
madheeswar
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of varvoura
varvoura

ASKER

OK, here's a script

Sub DeleteDocument( doc As NotesDocument )
      
      Dim dc As NotesDocumentCollection
      Dim respDoc As NotesDocument
      Dim nextDoc As NotesDocument
      
      Set dc = doc.Responses
      Set respDoc = dc.GetFirstDocument
      
      While Not respDoc Is Nothing
            Set nextDoc = dc.GetNextDocument( respDoc )
            Call DeleteDocument( respDoc )
            Set respDoc = nextdoc
      Wend
Call doc.Remove( True )

end sub

I place the above as a function in the database script section.
Then in the querydocumentdelete of the database script I call the function, but nothing happens.
Is my call to the function incorrect or should this not be in the querydocumentdelete section?



Call deletedocument(doc)
      
            
Even when I paste this in view event and call it from the view which has the parent document, i still have no luck.
Avatar of Sjef Bosman
http:Q_20569942.html "recursivelly marking responses for deletion"

And look at the PostDocumentDelete event in the Database script (under Other/Database Resources)
I'll give this a try.
However, just curious to why my function above did not work. Is the call to the function incorrect?

ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Still a problem, but maybe it is the way i am applying this.
If I have problems I move to your recommeded link.

Thank heaps for trying to help, I really appreciate it.