How to schedule a service as a job by code?

The code below in ServiceRun.xml cannot work, can anyone advise how schedule a service by code?

ec.service.schedule().name(serviceName).parameters(context).cron(cronString).call()

Interesting… the ec.service.schedule() method and the corresponding ServiceCallSchedule interface have been gone since 2016 when Quartz Scheduler was removed. I guess the cron string on that screen is a rarely used feature, I’ll probably just remove it.

With the service job interface you must have a ServiceJob record in the database. If something were to be added to do this without direct database interaction all it would do is add a ServiceJob record.

In other words, to do it programmatically and in a tracked and managed way, create a ServiceJob record either via code or manually, and then use ec.service.job() to call it.

1 Like

Thanks for your prompt reply, David!