How do I redirect to edit mode in postOpenDocument?

  • I am trying to do a redirect in postOpenDocument to bypass read mode and go straight to edit, after running some code to see if that’s appropriate. So the user clicks a link that says it’s going to read the document, pOD runs an Agent to check the document’s status, and if it’s “right” then it bypasses read and goes directly to edit.

  • I thought to use context.getUrl(), but that’s pointing to the server, not any particular application or document. I see from the Agent log that HTTP_REFER points to where I want to go. I’m going to see about using it.

  • BUT there may be something simpler, like currentDocument.setEditable() or some such.

Any ideas? Thanks for your time…

Subject: What I would do

Ideally, the time to do that sort of validation is when you’re building the link in the previous document - once you’ve established the yes/no of whether the user can edit the document, then it’s just a simple matter of appending ?EditDocument vs. ?OpenDocument in the URL your link calls. It also saves the user the annoyance and wait of having the screen flash at him while your code changes modes on him or her.

Subject: Thanks!!

  • This made me realize the (parent) document’s web page (that has the links on it) actually can get to data on the child because it’s in a repeat. The “var=” is a NotesXPSViewEntry, which has a document property I can call getItemValue() on to check “status” without explicitly instantiating the child.

  • Now the link does just what you suggest: directly to edit if that’s what to do, default to open.

Subject: No problem!

Always happy to help a famous rock star…

hahaha