I know I promised the flyout download today but that needs more work and I don't have the time today. Sorry.
Instead I need to ask for assistance. Something simple is driving me crazy and you're my only hope.
I have written a simple function in my global script library that I can use in all my agents to get the current user's Person document from the NAB. It's called GetUserDocument and looks like this:
Function GetUserDocument(username as String) As NotesDocument Dim NAB As New NotesDatabase(web.database.Server, "names.nsf") If NAB.IsOpen Then Dim UserView as NotesView Set UserView = NAB.GetView("($VIMPeople)") If UserView Is Nothing Then Set GetUserDocument = Nothing Exit Function End If Else Set GetUserDocument = Nothing Exit Function End If 'TESTING Dim tmp As NotesDocument Set tmp = UserView.GetDocumentByKey(username, True) print tmp.FullName(0) 'This prints ok and finds right user! 'END TESTING Set GetUserDocument = UserView.GetDocumentByKey(username, True) End Function
To test the function I've written an agent which contains the code below:
Dim UserDoc As NotesDocument Set UserDoc = GetUserDocument(web.user.Canonical) If UserDoc Is Nothing Then Print "Can't find it!" Else Print "Found it!" End If
The trouble is that it doesn't seem to work. What I get printed back is "Jake Howlett Can't find it!" which suggests that the function is getting to the end and the "tmp" document is found ok, but when the document is returned to the calling agent is becomes "nothing". What the...
I have other functions in the library that return NotesDocuments and they work fine. The only difference I can see is that they are in the same database, whereas, in this case, they are not. Is that some weird limitation I don't know about?