How to trigger another agent without a user

Hi to all.I have a condition in which the user,

will trigger an agent by clicking an button.

This agent do some computation,etc… then it has to trigger a 2nd agent and pass a parameter.

Currently it is done by redirecting the user to trigger the 2nd agent.

But if in between this triggering’s, our user closes the window then the 2nd agent won’t get triggered.

So isf there any way to trigger a LS agent(agent 2) directly from the another agent(first agent).

How to trigger an LS agent from another agent without any user interaction.

Thanks for your help in advance.

Subject: How to trigger another agent without a user

You can get the agent via the NotesDatabase.GetAgent and then call Run. Here you can even supply a parameter. Please have a look at the designer’s help for more details.

Subject: RE: How to trigger another agent without a user

Hi, Rob Goudvis.Thanks for your help.

I will try that.

The problem is that that the 2nd agent work for more then 1 condition so I can not edit it.

The 2nd agent takes the parameter using “Query_String”.

“Designer’s help” is very difficult to get what I want for this topic.

Once again

Subject: RE: How to trigger another agent without a user

To pass a parameter to a second agent you will need to create a temporary document to store your parameter and then pass the note ID of the temp document to the second agent. A simple example is below:


	Dim s As New notessession

	Dim db As notesdatabase	

	Dim agent As notesagent	

	

	Dim tempDoc As notesdocument

	

	Set db=s.currentdatabase	

	Set agent=db.getagent("NAME_OF_SECOND_AGENT_HERE")

	

	'set a temp doc that has the variables needed for the second agent

	'the server agent will run using this doc

	Set tempDoc=db.createdocument

	tempDoc.form="foTemp"

	tempDoc.QUERY_STRING="YOUR VALUE HERE"



	'add additional values to pass here...

	

	'make the current user an author so they can delete the temp doc

	Dim tempItem As notesitem

	Set tempItem=tempDoc.replaceItemValue("tempAuthorChoices",s.effectiveusername)

	tempItem.isAuthors=True

	

	Call tempDoc.save(True, True)

	

	'run the agent on the server (gets the number and stores it in the temp doc)

	Call agent.runonServer(tempDoc.NoteID)

	

	'remove the temp doc

	Call tempDoc.remove(True)

2nd agent has the following line to get the passed document:

Set doc=db.getdocumentbyID(s.currentagent.ParameterDocID)