Save&New

Hello All,I am trying to put code in a button on a web application to do a save for this document and create a new document but I dont get any error and no success here is my code

@Command( [RefreshWindow] );

@Command( [FileSave] );

@Command([ToolsRunMacro];“Save and New Detail”);

Here is the agent

Sub Initialize

Dim session As NotesSession

Set session = New NotesSession



Set db = session.currentdatabase

Set SettDoc = db.GetProfileDocument("Settings")



Dim doc As NotesDocument

Set doc=session.DocumentContext



Messagebox("1")

Dim detaildoc As NotesDocument

Set detaildoc=db.CreateDocument

detaildoc.form="Travel Request Detail"

Messagebox("2")



Call doc.CopyAllItems(detaildoc, True )

Call detaildoc.computewithform(False,False)



detaildoc.From=doc.To(0)

detaildoc.UNID=doc.UNID(0)



Messagebox("3")

Call doc.save(True,False)

Call detaildoc.Save(True,False)

End Sub

any advise will be great

Thanks

Dalia

Subject: Save&New

Dalia,

A few things. First, I’m not sure whether you’ll be able to copyallitems until the window is closed for your initial save. I haven’t tested that exact scenario, but I know sometimes these are tricky.

Second, if that works as long as you’ve saved, then let’s just save in the script, not in the @Formula language, so that there isn’t any confusion in the script about whether the doc has really been saved.

Third, why an agent? Why not just run this as button code, or QueryClose code?

Fourth, you say it doesn’t work but don’t give details. Does that mean that you don’t get your first messagebox? If that’s the case, then you’d troubleshoot that. But if you get your messageboxes but just not your desired results, then I’d try the things I suggested above.

good luck,

raphael