Response Documents on Web

Background: I am trying to create a Notes App that will be accessed through the web. I use a form to create a parent document. From this parent document, I have a button that opens a response document.

Problem: In the browser, when a main document is first created, there is a temporary document id. A permanent doc id is not created until the document is saved. So, if the response is created, it does not have the true doc id associated with it.

A few unsuccessful attempts at a solution:

  1. Inserting a @Command([FileSave]) in the button.

Result: I found out the hard way that the FileSave is executed after all other commands, no matter the order. So, the response document is being created, then the main document is saved. The response document is not associated with the permanent main doc.

  1. Perform a @Command([FileSave]) in the WebQueryOpen then have an agent clean up any empty documents periodically.

Result: This created Save Conflicts.

  1. Create a LotusScript agent that saves the main doc when the response doc is opened.

Result: This may be because of my lack of LotusScript skills, but this saves the main document without providing a connection to the response doc. My assumption is that since the actions are taking place at the server, a link is not created between the document in the browser and the document saved on the server.

Any suggestions or help would be very appreciated.

Subject: Response Documents on Web

If you need to create responses immediately in the web ui, then your attempt (2) is closest. You can use @If and @IsNewDoc in the WQO event to control the save and avoid conflicts.

Subject: Response Documents on Web

Hmm. I would save the document first and then call an agent. I’d pass the docid in the querystring so you’d have something like:

@command([FileSave]);

@command([FileCloseWindow]);

@URLOPen(“/” + @webdbname + “/youragent?OpenAgent&docid=” + docid )

where docid is computed on the form with @text(@documentniqueid)

Through to the agent side you can parse out the query string - search on querystring in this forum I’m pretty sure there’s LS and Java versions of how to do this.

So once you have the docid you can get the saved document and then you can use LS to make a new doc and make it a response with MakeResponse method.

Then, you can redirect back - I use a PrintWriter object in Java but imagine you can use Print in LS. You can build up the URL for your server and db and append /0/ and the docid of either the parent or response and send it back, also bung ?EditDocument if you want the document in edit mode. You can get the server with the CGI variable server_name and the database with db.getFileName() or the LS equivalent.

HTH, George :slight_smile: