schedule doesn't start

I have meetings ad I want Servoy to send an alarm to the attendees at a certain time before the meeting starts.

I don’t know why but scheduler doesn’t do anything at the given time.

var bDate = new Date(forms.action_meeting.act_date_begin);
var bTime = new Date(forms.action_meeting.act_time_begin);
var aTime = forms.action_meeting.act_alarm_time
var aTimeType = forms.action_meeting.act_alarm_timetype
var rValue = i18n.getI18NMessage('i18n:coperta.alarm.time.type.minutes-')

// minutes before
if(aTimeType == i18n.getI18NMessage('i18n:coperta.alarm.time.type.minutes+'))
{
var tDif = aTime * 60000
var startDate = new Date(bDate)
startDate.setTime(startDate.getTime()-tDif);
}
plugins.scheduler.addJob('meetingAlarm',startDate,globals.meetingAlarm())

What is wrong with my method?

Passing globals.meetingAlarm() doesn’t pass a reference to that method, but executes the method and passes a possible result of that method. Try this

plugins.scheduler.addJob(‘meetingAlarm’,startDate,globals.meetingAlarm)

sorry Patrick, no go!

The method is not triggered. I also manually set a date and time in a datetime field, but it doesn’t start at the given time.

if(aTimeType == i18n.getI18NMessage(‘i18n:coperta.alarm.time.type.date’))
{
var startDate = forms.action_meeting.act_alarm_date
}
plugins.scheduler.addJob(‘meetingAlarm’,startDate,globals.meetingAlarm)

anyone an idea? I’m desperate! :x

I tried some sample code that worked fine.
Try printing the date just before the plugin call.

Rob

Hello Rob,

Sorry for the late reply. Thank you! It works fine now.

By printing the date I saw a format error in my alarm time! :oops: