When I delete a timer's Schedule in Service Studio (or leave it empty) and set the Effective Schedule in the service center to When Published, I can't turn on the timer.
When I click to activate, it immediately disables
That's the expected behavior. Since the timer has no schedule, it does not need to be active. However, if you want to run it explicitly, you can click on 'Run Now.' By the way, what is your use case?
When you set it to 'When Published,' you will be able to see when it was last executed under 'Timer Report.'
It's because it's a timer to do the data load, so I need it to be like When Published in the Production and Homologation environments, but not in the development environment, because there are other timers and this decreases the performance of the development server.
The problem is that even with the When Published option, it doesn't execute when publishing.
What is the behaviour when you click on 'Run Now.'. Do you see something like below ?
Or are there any errors reported in Monitoring -> Timers for your timer ? ( except 'deactivated' )
When I click run now it works, but I can't get the timer on with Effective Schedule as When Published.
If you have the timer set to "When Published," it will always run when you deploy, regardless of the environment. What do you see under 'Last run' after your application is published? Does it show a time close to your publish time ?
According to this document on Configure site properties during deployment, "The site properties of the applications to deploy are set in the target environment after the apps are published. Beware of Timers that run When Published, since the site properties that the Timers may use are not yet updated when the Timers run." Do you see any possibility for that?
Unfortunately it doesn't run, shows the timer as disabled and doesn't show the next run.
As for the use of site properties, they are not used in this timer in the example above.
I was able to reproduce your situation and couldn't find a solution other than running it manually. It appears that the "Effective Schedule" of "When Published" has no effect when the "Default Schedule" is empty.
Exactly, so it kind of doesn't respect the service center's When Published option! kkk
In this case it's an outsystems problem, I thought it was only in my service center environment!
May be you could raise a ticket with OutSystems support to get a formal answer on this.
hi @Sabino Albuquerque Portela ,
I think a setting of WhenPublished doesn't really play well together with the real schedules, doesn't really follow the rules. Some quick observations besides yours :
behaviour when publishing is determined by what is set in Service Studio, regardless of what you do in Service Center. So if you want it to happen at WhenPublished, you can only do that from within Service Studio.
it is possible to set it as WhenPublished in Service Studio and to for example a daily schedule in Service Center. When later looking at it in Service Center, it looks like there is a daily schedule, WhenPublished is only visible as Default Schedule, but it will still run every time it's published, this is confusing / wrong information
looking at it in the timers list, the next run is showing the 'effective schedule'
but when i deactivate the timer, it doesn't show deactivated, it shows WhenPublished in the list (which is oddly enough the only time and place it is showing the truth)
for comparison, this is how it is showing in the detail, as if the weekly schedule is deactived
and here's where it gets completely crazy : after the next publish, it runs, and as a consequence, gets auto reactivated (a had deactivated, remember) and is back on the schedule !
all the above is downright ugly and sub par, imo.
As a developer, the only good approach to this is probably to never mix the 2 systems : either your timer is a WhenPublished, and then you don't touch it in Service Center, or it is a scheduled timer, and then you can do whatever you like with it except set it to WhenPublished in Service Center.
So for your use case, if you want it to run WhenPublished, you'll have to set that in Service Studio.
If you don't want it to run in certain environments, you'll have to add a site property, lets say RunTimerXXXXInThisEnvironment, immediately stopping execution of your timer logic when it is False.
Dorine
I'd advise you to check my timer article on Medium. It explains when timers run based on the schedule and manually activated runs.
Basically, the "run when published" option is checked by the part of the Platform responsible for publishing, not by the timer scheduler. Imho it shouldn't be selectable in Service Center at all. The scheduler can't know when a module is published, and the publish service doesn't check the timer schedule.