To start new cases automatically, you can create a process which has a Start Timer Event:
processWithStartTimerEvent.png (15.49 KiB) Viewed 3089 times
Set the "Properties" of the Start Timer Event for how often you want the new case to start. For example:
timerEventProperties.png (54.69 KiB) Viewed 3089 times
Then, set the
timereventcron.php script to periodically execute on your ProcessMaker server. See:
https://wiki.processmaker.com/3.2/Executing_cron.php
Another way to do it, is to create a separate process which loops periodically to execute a script task. The script task will
execute a trigger which calls PMFNewCase() and PMFPauseCase().
For example, here is the looping process that runs forever:
endlessLoopProcess.png (25.21 KiB) Viewed 3089 times
Then, the following trigger is executed by the script task:
Code: Select all$processId = '6772746095c4ece126bd7a8016893611';
$firstTaskId = '5280627375c4ece3ed269e6050127087';
$userId = '00000000000000000000000000000001';
$caseId = PMFNewCase($processId, $userId, $taskId, array());
if (!empty($caseId)) {
//pause the new case until the end of the month:
$endOfMonth = date("Y-m-t 08:00:00"); //ex: "2019-01-31 08:00:00"
@@ret = PMFPauseCase($caseId, 1, $userId, $endOfMonth);
}
Here is the process:
(38.06 KiB) Downloaded 266 times
Remember to set timereventcron.php to periodically execute on your ProcessMaker server, so that the process will loop. You can start one case and let it run forever.
If you need to find cases to pause, then your trigger can use executeQuery() to search the APPLICATION or APP_CACHE_VIEW tables for cases.