I have a web application. After submitting the form using documents.form[0].submit(), the document closes. Instead of getting closed, I need to open the same document in edit mode. I tried to print the doc URL through WebQuerySave Agent. Below is my code in the agent but this prints the last but one doc instead of last doc since the view is not refreshed. I tried adding view.refresh but still it gets the last but one doc. How do I refresh the view and get the current saved doc URL or is there any other way to get the currently saved doc URL ?
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim dbview As NotesView
Dim docUnid As string
Set db = session.CurrentDatabase
Set dbview = db.Getview("(WorkOrders)")
Call dbview.Refresh()
Set doc = dbview.Getlastdocument()
docUnid = doc.Universalid
Print "[https://kclisd01/nibsport.nsf/(WorkOrders)/" & docUnid & "?editDocument]"
End Sub