ROCLASI:
Hi Sammy,
Your clients see the effect because the method is also scheduled in their client.
What you need to do is to let the scheduling method know it is called from the batchprocessor.
The argument property is exactly what you need for this.
Your scheduling method will look something like this:
var bIsBatchProcessor = arguments[0];
if ( bIsBatchProcessor )
{
plugins.scheduler.addCronJob(‘30mins’,‘0 0/2 * * * ?’, globals.emails_all);
}
Now launch the solution as a batchprocessor and give it the parameter 'true' (no quotes).
That's all.
Hope this helps.
I just got a chance to work on this again. All my script has to do is send out an email when a new record is created in Servoy. I tried running this on developer. I followed exactly what you said putting launch batchprocessor parameter as true (no quotes). However, after I create a new record, no email gets sent. My email server is runing because if i run the email new record script manually, it works just fine. I reduced the interval to 2 minutes…still nothing. Anything else i’m doing wrong?
here’s my search script>
forms.admin_capa.controller.find()
forms.admin_capa.a_capa_opened_notified = ‘no’
var found = forms.admin_capa.controller.search()
for (var n = 1; n <= found; n++ )
{
forms.admin_capa.controller.recordIndex = n;
var to = ‘szheng1@ndcus.jnj.com’ //change to Maritza later , keyword bauer
var from = ‘ndc_fmodbc1@ndcus.jnj.com’
var subject = ‘A new CAPA , CAPA # ’ + forms.admin_capa.main_capa_num + ’ has just been opened’
var msgText =‘A new CAPA, CAPA # ’ + forms.admin_capa.main_capa_num + ’ has just been opened. Please log into Servoy CAPA system to find out more details.’
plugins.mail.sendMail( to, from, subject, msgText)
forms.admin_capa.a_capa_opened_notified = ‘yes’
application.sleep(1000)
}
here’s my scheduler script>
var bIsBatchProcessor = arguments[0];
if ( bIsBatchProcessor )
{
plugins.scheduler.addCronJob(‘2mins’,‘0 0/2 * * * ?’, globals.emails_all);
}
am i doing something wrong.
thanks again for your help