开发者

Notes Designer runs agent after saving

开发者 https://www.devze.com 2023-04-04 16:13 出处:网络
I recently switched to Notes Designer 8.5.2 and noticed if I am editing an Agent scheduled for running daily at 08:00 the agent runs right after saving changes in the programmers panel.

I recently switched to Notes Designer 8.5.2 and noticed if I am editing an Agent scheduled for running daily at 08:00 the agent runs right after saving changes in the programmers panel.

Is that开发者_如何学Go a new feature and how i can avoid that the agent runs now ?


No, that's an old bug...{ahem}...feature. At least I dealt with it a lot on 6.0 and probably earlier. When you save a scheduled agent you clear out the record on the server that the scheduled agent has run today, and it puts the agent back in the queue.

The workaround I adopted was to change the scheduled agent to a hidden manual agent. Then I would create another scheduled agent that runs the hidden manual one. You can then edit the manual agent as much as you'd like without triggering it when you save.

Here's the generic code I'd use in the scheduled agent. Just change the name of the agent and this should work for you:

Sub Initialize

    Dim s As New NotesSession
    Dim db As NotesDatabase
    Dim agt As NotesAgent

    Set db = s.CurrentDatabase
    Set agt = db.GetAgent("(Send Reminders)")
    Call agt.Run()

End Sub

UPDATE:

If you have access to the server, you can add a setting to the Notes.ini to prevent this behavior:

Amgr_SkipPriorDailyScheduledRuns=1


Its not regarded as good practise to edit an agent in a production application thats enabled but if you need to work on it then change the time to run at the end of the day until your done. You will still be able to run the agent from the agents view to check that any changes haven't broken the process.

Over the years I've actually found this feature useful as it allowed me to force the server to rerun an agent simply by opening and saving it in domino designer. Its always possible to run agents manually from the agent list but this isn't advisable as it will run using your credentials (user id) and hence it may not behave the same way if run under the servers id.

0

精彩评论

暂无评论...
验证码 换一张
取 消