Hi everyone. I’m using SuiteCRM since 2017. We populate target lists from reports. I think this is one of the main pourposes of the reports, to populate target lists under certain conditions to segment contacts. Suitecrm allow to schedule the reports, but it has no option to update the target lists when the report is updated via scheduler. I see that Suitecrm 8 still doesn’t have any option to do that. Now we do it through DB directly. Any thoughts about the best way to achieve it?
Hey @miquelangel !
Are you looking to improve your current DB script implementation? I could suggest (at a high level of a solution).
- Overwriting the existing Scheduler Task aorRunScheduledReports from within the extension framework. (I honestly can’t remember if this is easily doable, but you can certainly create a new scheduler task that mimics it)
- Your new (or overwritten) scheduler task would have an edited version of the function AORScheduledReportJob… https://github.com/salesagility/SuiteCRM/blob/881cb39e7fe014d07816bbfdce7d694dd9df8f21/modules/Schedulers/_AddJobsHere.php#L834 (or a new function, which you’ll need to reference that in the earlier aorRunScheduledReports).
- Where it sends out the email, you can add(customise) inner workings of the function action_addToProspectList https://github.com/salesagility/SuiteCRM/blob/a4afbded5514f64e11e9d4eaf995bfe96fda86c9/modules/AOR_Reports/controller.php#L132
It can’t be a direct reference, but you can certainly adapt it since you already have the report’s sql. Just watch out for thatdie
command at the end of the _addToProspectList
Have a look at combining these areas into a new scheduler task that you can execute (else overwrite the existing one but I wouldn’t suggest that unless that is your preferred default).