Custom scheduler with parameters

Note: Please do not suggest third party tools for this, I am not interested in purchasing any.

I am a Sugar customer with an On-Site 10.x Sugar Pro license.

I have a custom Scheduled Job for which the parameters change year after year.

Though I know how to trigger an ad-hoc scheduler with parameters from, say, a Logic Hook, I am looking for a way to set the Parameters at the time it is Scheduled.

In other words I want to run the Scheduler with parameters A, B at certain times, and with parameters C, D at other times, where those parameters and the frequency of the scheduler change year by year or month by month.

I'd really like to be able to have a non-developer/non-technical Sugar Admin be able to change the Scheduler to Active, set the timing for the scheduler to run, AND set the Event Code for that scheduler. 

This is the simplified scenario: We host a number of events every year. Our custom modules link registrations to the Event. Our Events Organization staff has no need to be in Sugar, but they want to receive a regularly scheduled report of registrations. Using a Sugar Report is not an option, we only have Sugar Pro and this is too complex for the kind of reporting we have access to, besides, I could not schedule the report for people who do not have a Sugar account.

Of course I can do this by hardcoding the Event Code in the Scheduler and using MailerFactory to email the report to their group email, it is what I've been doing. But every time there is a new event I have to edit the Scheduler's code and change the Event Code.

This also means that I can't, for example, schedule the emails for one event to be weekly and for another to be daily unless I write multiple schedulers... etc... 

Sure, I can build an API with params for this and an interface for them to run it ad-hoc, and I have, but they want a scheduled email.
I could build a mailer that runs the API with params, but again I have to be the one setting those params in the mailer, so I'm just rebuilding a "Scheduler"

I could build another module where our non-developer/non-technical Sugar Admins can pick the scheduler name, params, and start/end date for that scheduler, pick a frequency, then query that module to pick the parameters to be used... but the more I think about it the more it feels like reinventing the wheel... and should I really be building a scheduler for schedulers?! Thinking


Could I customize the scheduler module? Maybe...

So this more of a "what would you do" kind of question for those with more experience than me...


Any thoughts on what you would do? Slight smile

Thanks,
FrancescaS

Parents Reply Children