Set notesUIDocument = notesUIWorkspace.CurrentDocument
Returns a notesUIDocument which Represents the current document.
If there is no document currently open on the workspace, this method returns Nothing.
This is broken in ND6. When called in an agent run on a view, uidoc is not “nothing” as it was in R5. However, it’s also not “something.” i.e. the resulting uidoc’s underlying document has a noteid of “0”
I had successfully used this functionality (as documented in the Help) in a Notes 5 App to determine whether an agent been invoked from a form with a document open (uidoc available) or from a view (uidoc set to nothing)
I do have a workaround (i.e. noteid = “0”) I just wanted to share the info.
Out of curiosity, why do you have an agent run from a view action looking for a uidoc?
Is it because it is a common agent also used from a form action?
If so, I probably would not have encountered this problem because I use distinct code in these actions to call a Script Library Subroutine, passing doc as a parameter.
Is it because it is a common agent also used from a form action?
That’s exactly what’s happening. It’s actually invoked from an item in an Outline when using a view, or from a form when a doc is open.
I’m not convinced that this is the best arrangement, but it allows for an elegant implementation.
My concern is not that you can’t/shouldn’t do this… it’s with the fact that the code has been broken by moving to R6: supposedly the most tested, most solid Notes client “ever”. In fact there are quite a lot of serious problems that don’t seem to being fixed in the 6.0.x releases.