Declaring Form in a remote database

My question is more of curiosity than it is a problem, but if someone can shed light on this it would be appreciated! I’ve searched both the forum and Notes help but could not find the answer…

I have created both client and web-based Lotus scripts that create a new document in another database, then copy all items from the current document. The form name I declare for the destination document is not the same name as the originating document.

The client side calls an agent from QuerySave, while the web side calls a similar agent from WebQuerySave. Both agents call their respective script libraries to execute the create and copy function. Below is a portion of code from the web based script, but the client based code uses the same form declaration.

Dim session As New NotesSession

Dim db As NotesDatabase

Dim db2 As NotesDatabase

Dim item As NotesItem

Dim doc As NotesDocument	

Dim Results As Integer



Set db = session.CurrentDatabase

Set db2 = New NotesDatabase( "" , "Fleet-AM.nsf" )



Set doc = session.DocumentContext

Dim newdoc As NotesDocument		Set newdoc = db2.createdocument



newdoc.form = "AM-Asset-Int"



Call doc.CopyAllItems( newdoc, True )

Both scripts are successful, however when I view the document properties of the newly created documents, only the document created through the client shows the correct form name that was declared in the script. The web based copy’s form name is the same as the originating document, rather than the name declared in the script.

Is it correct that form declaration performs differently on the client side than the web side?

Subject: Declaring Form in a remote database

I assume you have tried putting the newdoc.form = “AM-Asset-Int” AFTER the doc.CopyAllItems line?

Subject: RE: Declaring Form in a remote database

You’re right. I guess I’ve just been looking at it too long and missed it totally… Thanks for your help!

Subject: Declaring Form in a remote database

You overwrite the form field during CopyAllItems(), except it isn’t yet created in the client app.

simply change the order to:

Call doc.CopyAllItems( newdoc, True )

newdoc.form = “AM-Asset-Int”

Subject: RE: Declaring Form in a remote database

You are right… and boy, do I feel foolish for missing the obvious! Thanks so much for your help.