In web applications, the new document determines which document to inherit from based on the URL argument ParentUNID in the Domino URL command, for example:
http://server/db.nsf/InheritanceForm?OpenForm&ParentUNID=6b87e303374b19148525639a00506656
set doc = NotesSession.DocumentContext
set newdoc = new NotesDocument(doc.ParentDatabase)
call doc.CopyAllItems(newdoc, true)