How to run agent in lotus script using evaluate function

How to run agent in lotus script using evaluate function

Thanks

sarangan

Subject: How to run agent in lotus script using evaluate function

See the Help file and example.

Is there a specific code example you are having trouble with?

Subject: RE: How to run agent in lotus script using evaluate function

Sir

Thanks for your reply

In help file there is no example.

My question is

result=Evaluate(@command[runagent];“Agentname”))

it is correct code or not. if it wrong then please write me to what are the steps for run the agent in lotus script. I try many type of ways,nothing to work. Even i search in web,there is no code available in web.

reply me

Subject: RE: How to run agent in lotus script using evaluate function

HiYou cannot evaluate Commands

Subject: RE: How to run agent in lotus script using evaluate function

You can use the NotesAgent object, and the notesAgent.Run method in script.

It’s all in the help files.

HTH

Ben

Subject: RE: How to run agent in lotus script using evaluate function

Sir

I using this notesagent object,But it not working correctly.If you having the code please mail to me

bye

Sarangan

Subject: RE: How to run agent in lotus script using evaluate function

Sarangan,

Post your code here, and we’ll try and work out where you’re going wrong.

Ben

Subject: RE: How to run agent in lotus script using evaluate function

Sir,

I give the example code for my problem.This code working correctly my main code will work perfectly.

The example code is:

In a view action button click event code

Sub Click(Source As Button)

Dim s As New NotesSession

Dim db As NotesDatabase

Dim agent As NotesAgent

Set db = s.CurrentDatabase

Set agent = db.GetAgent("test")   'Test is the agent name

If agent.Run = 0 Then

	Messagebox "Agent ran",, "Success"

Else

	Messagebox "Agent did not run",, "Failure"

End If

End Sub

My agent code : “Test”

Sub Initialize

Msgbox "Test the agent"

End Sub

I click the action button,the msgbox not display,but an error is display. The error is

Unsupported trigger and search in the background or embedded agent.

I run the agent using formula command runagent event the msgbox display correctly.

How i rectify this error.

reply me

Thanks for ur previous reply

Sarangan

Subject: RE: How to run agent in lotus script using evaluate function

Sarangan,

The problem lies with your agent, not the code launching it.

The error means that the agent’s usual trigger (from actions menu, against selected documents) is not supported when it is called as a back-end agent.

Change the agent to run Manually from Agent List and make sure the agent is not set to run against “selected documents”.

Good Luck

Ben

Subject: RE: How to run agent in lotus script using evaluate function

Sir,

I make the respective change and the agent run correctly.

Thanks

bye

Sarangan

Subject: RE: How to run agent in lotus script using evaluate function

Sir

Then How to run agent in lotus script.

My problem is :

I have a button in view. In button click event i run an agent. How it is possible to run. If any code available please mail to me.

bye

Sarangan

Subject: RE: How to run agent in lotus script using evaluate function

If you just want to run an agent, then use the Simple Action option to run an agent in your view action. Otherwise, see my other post.