I have a Notes Web Application with an agent inside WebQueryOpen that gets the current user ([CN] format), gets a view from names.nsf and does a getDocumentByKey, passing the user name and it returns Nothing!
I have no problems opening the DB and also the view loads successfully…
If I force the user name variable content in order to debug on Notes Client, it works!!!
I created another application that just perform this lookup and it doesn’t work either.
I tested in another server and the code worked over the web without problems.
Since it worked on another server, I’m starting to think that some kind of configuration is missing…
Subject: GetDocumentByKey doesn’t care whether the caller is a web agent
You did well to debug the code from a client with a known input. This shows that there’s nothing wrong with the view design or with the way you call the function. Remaining issues that might be causing your trouble:The web user doesn’t have access to the database, the view, or the document you’re looking up.
The key value you create, doesn’t exactly match the value in the view column.
An error is occurring at some other point in the code, which prevents the agent running to completion.
You’re not making correct use of the return value of GetDocumentByKey.
Think of additional debugging tests you could do to rule out these possibilities. Some hints here: Debugging Domino Applications part 1 and part 2 and here: Troubleshooting @DbLookup, @DbColumn, GetAllDocumentsByKey.