Is there a way to retrieve the user who initiated the agent on the server? Not the agent signer.
I have an agent that used to run on the client that retrieved the user info in order to process work only for that user, now we want to bypass the client and we issue a console command to run the agent, only now session.CommonUserName gives me the server.
Subject: How to get current user in agent on server
We have an iseries application in which the user chooses a letter to generate and gets all the member info and data for the letter.
we have…the user open the client and click a create button which creates a parameter document in which the letter and user are identified then initiates the agent to create on the server.
we want…no action on the client…just to open the letter in the bowser or client automagically!
…maybe the iseries should create the equivalent of the parameter doc on the iseries and I can access it using DCRs?
Subject: How to get current user in agent on server
I don’t think the agent stores that info. Further, even if it did it probably would not be accurate since another user could also initiate it before it actually runs for the first user (i.e., 2 users initiate the agent within a second or two of each other). What exactly does the agent do? You may need to create some sort of control or profile doc for each user. Have the user go to the control doc and toggle a check box or something. Run your agent against those docs every 15 minutes to check for docs that need to be processed then run the agent for those users; would that work for you?
Subject: RE: How to get current user in agent on server
I’ve dealt with a situation a little similar before. I ended up creating a very simple agent lanched when the user did something which created a simple document which contained the distinguished name of the user who made a transaction as well as the UNID of the document from which he requested the transaction.
Then the scheduled agent would go through all the transactions recorded in the the view and delete them once they were processed.