I am at a total loss and beg for help. I have a form with a button. The button takes the noteID of the current doc and passes it to an agent with .RunOnServer. I have print statements in the agent and watch the server console as it runs. When I personally run this agent with a document, I can see that the agent gets the handle to my document without a problem. When another user does it (same exact rights as me) I can see in the print statements that the handle to his document is not obtained by the agent. I have tried everything I can think of; using UNID, whatever… I can’t get it to work for him the way it works for me. Any ideas??? This is URGENT.
Set doc = myDb.GetDocumentByID(agent.ParameterDocID)
You might want to print the s.EffectiveUserName property in the log to see if that’s different for both cases. Is this a Web triggered agent?
I use this with no problems. Also remember it’s the NoteID, not the UniversalID, or at least that’s what I use, when sending the strNoteID.
Make sure the user is getting a valid handle to the database before trying to get the document too. You are probably already doing that, I’m just trying to rule out everything else.
I’ve just written 3 agents that use this technique, so I’ll be glad to help.
So I am assuming the form and the agent are in the SAME database. Silly question, I know, but I actually call an agent in ANOTHER db from the client’s UI db. Then I once forgot to change the profile doc to point back to the correct database that actually had the NoteID for which I was searching. This isn’t your problem if the user is in the same database that houses the agent, just an funny story.
You can reach me at JasonSheats12 on AIM if you want to discuss this further. Just seems easier that way.
That was the only way I ever had a problem with NoteID was when I was calling GetDocumentByID from the wrong db handle.
It is too weird. I have used the same thing over and over. I am passing the NoteID, and this is a client based app. I looked at the reader fields but they’re fine.
This app does the following - user creates a new doc, enters an employee ID and clicks Process. Process passes the NoteID to an agent and then uses LSXLC to get to SAP and pull the employee data. That part goes just fine.
Then the user updates the same document (so we know it exists) and then clicks Submit. Submit passes the same NoteID to another agent and again uses LSXLC to get to SAP and submit the changes. This is the part that’s failing.
My code checks for all objects and prints to the console along the way. Like I said, when I do it, it goes ok. When my coworker tests it (he’s on the SAP side) it prints “No handle to PSC Doc” which is my own error code showing there was no handle obtained with GetDocumentByID ( strNoteID )