Subject: How to handle writing to uidoc from dialog box?
I guess I don’t follow what your issue is. If you are initiating a dialogbox in script from a form, you already have a handle to the current uidoc from the initiation point.
I proposed a solution that would work in a previous post. Like I said, set an environment variable to the UNID of the original UIDOC. Then you can get a handle to it from your dialogbox using a few methods such as GetDocumentByUNID to get the backend doc and then the front end doc using:
Set notesUIDocument = notesUIWorkspace.EditDocument(True,Doc)
Subject: How to handle writing to uidoc from dialog box?
Make sure you have a computed text field docID with formula as @Text(@DocumentUniqueID), in all the documents of your loop. If you do not have one create a field and update it with an agent. Get the key(uidoc.FieldGetText(“DocID”) in your dialogbox action, into a variable. Compare it with documents in loop. When you get the ui backend document, save it this way,
if uidoc.FieldGetText(“docID”) = docInLoop.docID(0) then
uidoc.Document.Field1 = “A”
uidoc.Document.Field2 = “B”
Call uidoc.Document.Save(True, True)
Call uidoc.Refresh (Refresh uidoc with newly saved values)
Subject: RE: How to handle writing to uidoc from dialog box?
Thank you for your response. I am struggling with getting a handle on the uidoc from the dialog box.
I have tried using the editdocument method to bring with the newinstance=false flag. But, this not seem to work. I believe it fails because, with the dialogbox open, I can not change focus to any other uidoc.
Subject: RE: How to handle writing to uidoc from dialog box?
Why do you want to get a handle of uidoc. In dialogbox, when you use uidoc, it will be the document in the dialogbbox but not the underlying document.
If you are trying to get the dociD, what you can do is, Have a “computed hidden field” → dlgDocId and in the script which is opening the dialog box, update this dlgdocid as:
dlgdoc.dlgdocID = uidoc.FieldGetText(“docID”) or
dlgdoc.dlgdocID = uidoc.Document.docID(0)
and then open the dialogbox. This way you don’t have to bother about the underlying uidoc when you open the dialog box. From Dialogbox, now you can get the docID from the field dlgdocID and use it to find if it exists in the loop.