I have a form… that sometimes needs to be a response to a document and sometimes needs to be a main document.
So, I thought, no big deal… I’ll make it a document form type and then use the .makeresponse method when I need it to be a response.
Of course, I have seen the error of my ways, and when my document is saved later, the $Ref field is removed and it becomes a main document…
So, I thought, fine, I’ll define my form as a response instead of a document…
Then the respones part works great…
Now, if I want to create document as main documents using this form design, I thought, hmmm… I can just delete the $Ref.
So, I thought, I’d create the document on the back end and then bring it to the front using the following code called from an action button in a view:
Dim Session As New NotesSession
Dim db As NotesDatabase
Dim Workspace As New NotesUIWorkspace
Dim uidoc As NotesUiDocument
Dim Doc As NotesDocument
Set db = Session.CurrentDatabase
Set doc = db.CreateDocument
With doc
.form = "LOE"
.from = Session.UserName
.requestType = "LOE"
.saveoptions = "1"
End With
Call doc.save(True,True,True)
Set uidoc =workspace.editdocument(doc)
Call doc.removeitem("saveoptions")
When I envoke the code, and I use debugger, I can see the document being created. But when I try to bring it to the front user interface with teh workspace.editdocument(doc) call
it opens the document from the view that I am sittiong on…
Any clues as to what I should try…
Thanks in advance…