只需使用代理(触发器:无)。URL 类似于:/database.nsf/YourAgentname?OpenAgent&clone=12345678
在代理中,您可以获得如下参数:
Dim ses as New NotesSession
Dim docParam as NotesDocument
Dim strQueryString as String
'- Get the parameter- document
Set docParam = ses.DocumentContext
'- get the querystring
strQueryString = docParam.getitemValue( "Query_String" )(0)
'- querystring will be OpenAgent&clone=12345678
'- here you can extract the id from the querystring
....
'- then you get the document (if 12345678 is the noteid e.g by db.GetDocumentByID( )
'- or if it is your own key by NotesView.GetDocumentbyKey()
Set docOrigin = ....
'- Now create a new doc
Set docClone = New NotesDocument( db )
'- Fill the fields
Call docClone.ReplaceItemValue( "Field1" , docOrigin.GetItemValue( "Field1" ) )
'- Or all at once
Call docOrigin.CopyAllItems( docClone )
'- Here is the trick: Redirect to the new document using the agent output:
Print "[/" & db.HttpURL & "/_/" & docClone.Universalid & "?EditDocument" & "]"
括号使浏览器直接重定向到该页面...
这段代码只是从“内存”中编写的,可能包含拼写错误/逻辑错误,但它应该是一个很好的起点......