The agent runs perfectly when executed from the menus, but fails when run on a schedule. I have traced the problem to the following line:
db = session.GetDatabase ("ServerName", "DBName", False)
The db object is null when run on a schedule. I have set runtime security (via the 2nd tab in the agent properties) to every available setting with no effect.
I have tried leaving the ServerName parameter blank:
db = session.GetDatabase("", "DBName", False)
I have tried specifying the ServerName parameter as follows:
db = session.GetDatabase (session.CurrentDatabase.Server, "DBName", False)
Nothing seems to work, and I have exhausted both my abilities and my patience. Do you have any suggestions?
Otherwise, it sounds like a security-related issue. If the ID signing the agent does not have rights to open the target database, then the db object will not be instantiated.
Here are a few things to check:
- Ensure that your code actually includes the word "set" before "db", because you are trying to instantiate an object handle, so that keyword is needed.
- Ensure that the session object is instantiated properly.
- Ensure that the agent is not using any UI classes (which would cause any background agent to fail).
- Verify the agent's runtime security level to be appropriate to the type of actions it's performing.
- Try re-signing the entire database design with the same ID, just to be refresh the signature.
- Try signing the agent with another ID (preferably the server's ID) that has rights to access the target database. This could at least help confirm whether it's a security issue and not a code issue.
If all else fails, read through Julie Kadasevich's articles on troubleshooting agents at IBM Developer Works.
Do you have comments on this Ask the Expert question and response? Let us know.
Dig Deeper on Lotus Notes Domino Agents
Related Q&A from Brad Balassaitis
Upon moving to Lotus Notes 8, some Lotus Notes users received an error message stating: 'Database has not been opened yet.' Find out why here. Continue Reading
Discover what security settings you need to fix if you encounter the Lotus Notes database error: 'database is not opened yet.' Continue Reading
Learn the Formula language code that you can use if you'd like your Lotus Notes form with embedded views to stop displaying all response documents. Continue Reading