I’m trying to pass the universal ID of one document to another one, and then open the first document by using that unid.For some reason, though, it seems that the first document doesn’t actually save.
Here’s the relevant code:
First document (parentInvoice = uidoc):
Call parentInvoice.Document.ReplaceItemValue(“SaveOptions”, “0”)
Call parentInvoice.Save
Dim UID As String
UID = Cstr(parentdoc.UniversalID)
Messagebox(UID)
Call doc.ReplaceItemValue(“CreatedByUNID”, UID)
Call ws.EditDocument(True, doc)
Call parentInvoice.Close
Second document:
Dim doc As NotesDocument
UNID = uidoc.Document.GetItemValue(“CreatedByUNID”)
Messagebox("Save: "& UNID(0))
Set doc = db.GetDocumentByUNID(UNID(0))
This throws error 4091, which by documentation means that the document by that UNID could not be found. the first document cannot be found by any views either. Now, why doesn’t that first document save?
Subject: Problems saving a document (programmatically)
Setting SaveOptions to “0” means that the document WON’T be saved. Try setting it to “1”.
This is well documented in the Domino Designer Help File.
Regards
Ethann Castell
Caliton Innovations
www.caliton.com
Subject: Solution.
This is probably a mistake that most lazy and/or unattentive people learning notes/domino learn to avoid after failing it once:
SaveOptions = “0” makes the uidoc.Save prompt
always choose “No”, thus avoiding prompting the user.
→ Change it to SaveOptions=“1” and it always saves without prompting.
I’ve always used saveoptions=0 to avoid saving of a uidocument when dealing with rich text fields. Never actually thought that it meant “don’t save”
Subject: Problems saving a document (programmatically)
It might have something to do with setting SaveOptions to “0”.
Subject: RE: Problems saving a document (programmatically)
Thanks for the answer, I was just postinga follow-up myself about the very same thing.
That’s just something I never actually studied thoroughly enough to understand before this.