running an agent from a different database

Hi, I need to run an agent of a database from another database.

I mean, In database A i've a button in one of its view and when it is clicked, it should run an agent from database B.

Lets say I've an agent in Database B. The normal formula to run this is

But I want to run this agent by clicking a button in Database A.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bozzie4IT ArchitectCommented:
You can't in Formula, but you can using script .  Put this in your Lotusscript - button area.

Dim s As New NotesSession
  Dim db As NotesDatabase
dim otherdb as notesdatabase
  Dim agent As NotesAgent
  Set db = s.CurrentDatabase
set otherdb = s.getdatabase( db.server , "OTHERDB.NSF" )
  Set agent = otherdb.GetAgent("(agent)")
  If agent.Run = 0 Then
    Messagebox "Agent ran",, "Success"
    Messagebox "Agent did not run",, "Failure"
  End If
Andrea ErcolinoCommented:
in Notes 6:

@Command( [FileOpenDatabase]; server : database );
@Command( [RunAgent]; AgentName );
sridevi911Author Commented:

I get an error at the following :

Set otherdb = s.getdatabase( db.APPS01/SIVX , "apps2/cust.nsf" )

how do i specify the server part?

There are many users who have R5. so if the above only works on R6 then it would be a problem

Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

Andrea ErcolinoCommented:
Yes, my solution works only for at least Notes 6...
Then you should do as Bozzie4 said.
You have to code it like this

Set otherDB = New NotesDatabase(otherdbserver, otherdbpath).

This should work fine.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sridevi911Author Commented:
kalios.. works fine. thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.