1
votes

Is there a way to make a schedule agent that runs on the specific dates and information that the user entered in a profile document?

Two Scenarios:

A: The field being used from the profile document has the properties "Can have multiple values" activated. I would like the agent to run whatever the values are inside that field. The field contains the specific dates.

B: There are multiple fields like "Schedule: "Daily" or "Once a month" and the likes" which is almost the same as when you create the schedule for the agent that would be used by the agent as the properties for scheduling and running the agent.

This is possible by always running a scheduled agent and checking the data from the profile document then just check if the agent should continue or not but is there another way which would be better than the one mentioned earlier since it required the agent to always run most of the time. I would like to create the setup of the agent based on profile document.

Thanks a lot in advance.

2
I don't see the problem in running the agent every 5 minutes and checking the profile document. That does not cause any practical load on the server.Panu Haaramo
I think it's a waste of resources to run an agent every 5 minutes if you want to execute code "Once a month" especially if server hosts hundreds of applications. But yes, it depends on size of company, number of applications, system infrastructure and so on.Knut Herrmann
Actually if I understand the question correctly, it's enough to run the agent once a day. But I like your answer, it's much better than the accepted one.Panu Haaramo
Thanks. Without setting schedule per LotusScript you actually have to run agent every 5 minutes because user can set in profile "Daily at xx:xx" and xx:xx might be already some minutes later and user expects running the code at xx:xx the current day and not the next day.Knut Herrmann
Hi panu, well the user would change the value any time in the day so it must be run depending on the details on the document thus I can't set a time in the setting since the user must be able to change it through the document.. but I requested to the user that it would just run one time daily and just check the details on the document. They agreed thankfully.. But Knut answer is really helpful and it added new knowledge to me... Thanks a lot Panu and KnutKevin Patrick Tan

2 Answers

4
votes

As far as I know there is no such functionality supported in Lotus Notes. Agent scheduling setup cannot be directly based on a profile document.

I would implement an agent that runs every 5 minutes (interval depends on the agent's goal) and check settings in a profile document and act accordingly.

2
votes

It is possible to set an agent's schedule with LotusScript. Here is the code (12 years old but still working):

http://www-10.lotus.com/ldd/46dom.nsf/0/65389424caefa06980256b260051da56?OpenDocument

With Sub GetAssistInfo you get the current schedule values of an agent. You can change them and save the new values with Sub SetAssistInfo.

Example: set agent's schedule to daily at 02:00:

Dim session As New NotesSession
Dim info As AssistInfo
Dim agentName As String

agentName = "yourAgent"
GetAssistInfo session.CurrentDatabase, agentName, info  
info.IntervalType = 2   ' set "Daily"
info.Time1 = 360000 * 2 ' set 02:00
SetAssistInfo session.CurrentDatabase, agentName, info

You have to figure out the possible values for schedule's parameter. The code behind the link offers a message box which shows the current values of an agent. So, it's easy to find the values you have to set.

Having this, you can run the code from your profile document and set agent's schedule. You could also let your agent itself change it's own schedule for next run.