Schedule a Formula Agent?

Greetings all – I have 5 agents written in formula that I need to run on a daily schedule. The agents are long but simple If statements that look at what fields are completed and update a status field.

I tried calling these from an LS agent (Formula doesn’t seem to be allowed to be scheduled) with no luck. Log didn’t report any errors - said it ran fine - but the agent I called didn’t do anything.

Each agent is set to trigger on Agent selection with a Target of None.

The new agent calling them is On Schedule with a Target of All Docs in database. Here’s my code:

Dim Session As New NotesSession

Dim agent As NotesAgent

Dim db As NotesDatabase

Set db = Session.CurrentDatabase

Set agent = db.GetAgent(“(Update Process Indicator and Date v2)”)

Call agent.run

Oddly enough, I also tried calling a LotusScript agent and that didn’t seem to work either. Again, no error messages and no results from the called agent.

Thanks in advance for any insight.

Josh

Subject: RE: Schedule a Formula Agent?

Of course you can schedule a formula agent. There’s no need to call them from another agent.

Maybe the reason your agent doesn’t do anything, is that your agent doesn’t do anything.

Subject: Schedule a Formula Agent?

Formula agents work fine on a scheduled basis.

Set the agent trigger to on schedule and then set the schedule to daily and the time when you want it to run. Set it run on all documents in the database and then use the Document Selection section to refine it.

Subject: Solved; new issue: Refresh UI docs

Thanks for your feedback – it worked! I realized that I had some @Commands which was causing the original problem.

Of course now I have another problem: the agents modify the document appropriately but the Views which are based on the field aren’t updated. Any suggestion on how to update the views within the agent, if possible?

Here’s the concept:

Fields in document are updated by another database.

Agent runs to update the status field on document based on the info received from the other database.

The status field drives a ‘to-do’ list for employees

To-do list views need to be updated when agent runs, or else work won’t move.

Thanks again!

Subject: RE: Solved; new issue: Refresh UI docs

investigate .refresh method of notesview class in Lotuscript help

Syntax

Call notesView.Refresh

Subject: RE: Solved; new issue: Refresh UI docs

Thanks, I thought of that but came on a few roadblocks:

  1. It’s a formula agent - would require me to rewrite a lot of code that I don’t know I have time for. I’ll test with a LS agent though…see results below.

  2. Since this is a background agent running throughout the database, what view would I refresh? If I refresh one will others be updated?

  3. I created an action button and tried view.refresh, ws.viewrefresh and ws.viewrebuild. None of them worked. I also tried an LS agent to modify the document to see if it was because the formula agent wasn’t modifying the backend the way that view.refresh wanted it to, and still no luck.

Thanks again…

Subject: RE: Solved; new issue: Refresh UI docs

Check the view index settings, on the advanced (propeller beanie) tab of the View Properties dialog. Is the refresh set to set to “Manual” or “Auto, at most every… X hours”?

Subject: RE: Solved; new issue: Refresh UI docs

Thanks - it’s set to “Auto after first use”. Changing it to Automatic hasn’t helped either.

Subject: RE: Solved; new issue: Refresh UI docs

Ooops! Appears there was a problem with the view I was using. The column I expected to change was based on more fields than the agent was changing.

Everything is working great! Thanks again everyone!