Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderator: amosbatto

Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
By Processnico
#813307
How can i notify someone with email everyday?
Because i put on my task 5 days duration, if the user forgot to fill up the task i want to notify them to remember the task.
By Processnico
#813405
I follow all the instructions like create a template and triggers and put before the dynaform. But it didn't work, can you help me?
Thanks.
Last edited by Processnico on Tue May 29, 2018 3:45 am, edited 1 time in total.
User avatar
By amosbatto
#813427
Do you see anything when you manually execute your workflow/engine/bin/timereventcron.php file?
I can't tell what is the problem from the screenshots. Can you export the two processes and post the .pmx files?
User avatar
By amosbatto
#813481
There is a misplaced ' in the array in your trigger code that caused an error. Also need to instantiate G() in recent versions of PHP to avoid warnings.

Try this:
Code: Select all
//find the task ID by running a case in Task_2 and look at the TASK system variable:
$taskId = '3333725465a8afa8e9523d6091948077';
//set to the same email address used in Admin > Settings > Email Servers:
$emailFrom = '[email protected]'; 

$g = new G();
$now = date('Y-m-d H:i:s');
$query= "SELECT * FROM APP_CACHE_VIEW WHERE TAS_UID='$taskId' AND 
   (APP_STATUS='TO_DO' OR APP_STATUS='DRAFT') AND DEL_THREAD_STATUS='OPEN' AND
   DEL_TASK_DUE_DATE < '$now' ";
$aCases = executeQuery($query);
if (!is_array($aCases)) {
   die("Error: Bad Query: $query\n");
}

foreach ($aCases as $aCase) {
   $c = new Cases();
   $aCaseInfo = $c->loadCase($aCase['APP_UID'], $aCase['DEL_INDEX']);
   $aData = array(
      'caseNo' => $aCase['APP_NUMBER'],
      'caseTitle' => $aCase['APP_TITLE'],
      'caseStatus' => $aCase['APP_STATUS'],
      'taskName' => $aCase['APP_TASK_TITLE'],
      'taskAssignedDate' => $aCase['DEL_DELEGATE_DATE'],
      'taskDueDate' => $aCase['DEL_TASK_DUE_DATE'],
      'caseCreatedBy' => $aCaseInfo['CREATOR'],
      'caseStartDate' => $aCaseInfo['CREATE_DATE'],
      'caseUpdatedDate'=> $aCaseInfo['UPDATE_DATE'],
      'caseLink' => ($g->is_https() ? "https://" : "http://") . $_SERVER['SERVER_NAME'] . 
          ':' . $_SERVER['SERVER_PORT'] . //comment out if no port number
          '/sys'[email protected]@SYS_SYS.'/'[email protected]@SYS_LANG.'/'[email protected]@SYS_SKIN.'/cases/open?APP_UID=' . 
          $aCase['APP_UID'] . '&DEL_INDEX=' . $aCase['DEL_INDEX'] . '&action=draft' 
   );
   $aUser = userInfo($aCase['USR_UID']);

   PMFSendMessage($emailFrom, $aUser['mail'], '', '', 'Overdue case ' . $aCase['APP_TITLE'], 
       'overdueCase.html', $aData);
}  
If you turn on Debug Mode you will see errors listed in the __ERROR__ variable.
By Processnico
#813488
I'm sorry if i insist for this. I'm newbie with this software and i want optimize my process with some control, like notify with mail the user everyday if they don't fill up the form.
User avatar
By amosbatto
#813499
If you want it to execute once a day, you need to follow the instructions in the original post:
Create a separate process with a looparound which periodically executes a script task:
SendEmailIfTaskNotCompleted.png
SendEmailIfTaskNotCompleted.png (15.99 KiB) Viewed 3828 times
That script task will execute the trigger. Set the intermediate timer event to execute once per day.

The $taskId needs to be set to the ID of a task in another process.
By Processnico
#813507
I should to create a new project(process) for the controll or i can put the new process in tha same project?
By Processnico
#813508
They don't notify me if the task doesn't complete but they notify me when the task are complete.
I want to show you the process.
Attachments
COntrollo.png
COntrollo.png (40.17 KiB) Viewed 3819 times
User avatar
By amosbatto
#813526
If DEL_THREAD_STATUS='OPEN', then is shouldn't be finding completed tasks. Maybe your tasks aren't being closed properly.

Try this SQL query in your trigger code:
Code: Select all
$query= "SELECT * FROM APP_CACHE_VIEW WHERE TAS_UID='$taskId' AND 
   (APP_STATUS='TO_DO' OR APP_STATUS='DRAFT') AND DEL_THREAD_STATUS='OPEN' AND
   DEL_FINISH_DATE IS NULL AND DEL_TASK_DUE_DATE < '$now' "; 
By Processnico
#813566
Code: Select all
}  
I'll try but they don't notify me that task are not fill up.

If you see the model, i put idtask on "Admin riceve una mail".
Because i want to try if i don't fill up the form, process maker send me a mail that they said to fill up the task.
Attachments
try.PNG
try.PNG (5.96 KiB) Viewed 3801 times
Last edited by Processnico on Tue May 29, 2018 3:45 am, edited 1 time in total.
User avatar
By amosbatto
#813581
Processnico wrote:Because i want to try if i don't fill up the form, process maker send me a mail that they said to fill up the task.
ProcessMaker should send an email when the task is overdue. Check whether emails were generated by opening the case which is running your script task. Go to Information > Messages in the menu (or check the APP_MESSAGES table in the database). Where any emails generated?

Have you verified that the timereventcron.php and cron.php files are being periodically executed on your ProcessMaker server? Have you tried manually executing them?
User avatar
By amosbatto
#813619
First of all, change to root and then change the ownership of the files to "daemon", which is the Apache user in Bitnami:
su or sudo su -
chown -R daemon:daemon /opt/bitnami/apps/processmaker/htdocs/shared/sites/

Then, you need to execute the command as daemon like this:
Code: Select all
su -s /bin/sh daemon -c "/opt/bitnami/php/bin/php /opt/bitnami/apps/processmaker/htdocs/workflow/engine/bin/timereventcron.php"
Does that fix the problem?
By Processnico
#813642
I follow your instruction and they give me this. After this procedure, what should i do?
Code: Select all
| > Continue the case #156
| > Routing the case #156...
|     - OK
|
| > Continue the case #158
| > Routing the case #158...
|     - OK
|
| > Continue the case #147
| > Routing the case #147...
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
|     - OK
|
| > Continue the case #148
| > Routing the case #148...
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
|     - OK
|
| > Continue the case #171
| > Routing the case #171...
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
|     - OK
|
| > Continue the case #172
| > Routing the case #172...
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
**ID_TEMPLATE_FILE_NOT_EXIST**
|     - OK
+------------------------------------------------+

Finished 1 workspaces processed
User avatar
By amosbatto
#813643
ID_TEMPLATE_FILE_NOT_EXIST means that you don't have the email template file that you specified in PMFSendMessage().

In the process where you are execute the script task, you need to have an email template file named "overdueCase.html".
By Processnico
#813682
They give me an error. can you help me?
Because after i execute cron.php they give me an error, so i found something on the forum and i used chmod www-dati:www-dati /opt/.... and they give this error.
Last edited by Processnico on Tue May 29, 2018 3:46 am, edited 1 time in total.
User avatar
By amosbatto
#813684
You need to change the ownership of all the PM files to the daemon user, so you don't get these file access errors.

Do this:
su or sudo su -
chown -R daemon:daemon /opt/bitnami/apps/processmaker

Then, execute the PM cron scripts like this:
su -s /bin/sh daemon -c "/opt/bitnami/php/bin/php /opt/bitnami/apps/processmaker/htdocs/workflow/engine/bin/cron.php"
su -s /bin/sh daemon -c "/opt/bitnami/php/bin/php /opt/bitnami/apps/processmaker/htdocs/workflow/engine/bin/timereventcron.php"
By Processnico
#813685
Thank you.
I follow the command and the result is
Code: Select all
If do you want force the execution use the option "+force", example: php -f timereventcron.php +wworkflow +force
User avatar
By amosbatto
#813687
Then do this:
su -s /bin/sh daemon -c "/opt/bitnami/php/bin/php /opt/bitnami/apps/processmaker/htdocs/workflow/engine/bin/timereventcron.php +force"
By Processnico
#813696
This is the output, but i didn't receive any notification.
What should i do?
Code: Select all
Processing workspace: workflow
+------------------------------------------------+
| Not exists any record to start a new case, on date "2018-03-16 11:40:58 (UTC +00:00)"
+------------------------------------------------+
| > Continue the case #158
| > Routing the case #158...
|     - OK
|
| > Continue the case #156
| > Routing the case #156...
|     - OK
|
| > Continue the case #147
| > Routing the case #147...
|     - OK
|
| > Continue the case #171
| > Routing the case #171...
|     - OK
|
| > Continue the case #148
| > Routing the case #148...
|     - OK
|
| > Continue the case #172
| > Routing the case #172...
|     - OK
+------------------------------------------------+
User avatar
By amosbatto
#813701
There are various cron scripts and I don't know you processes, so I can't tell you which ones you need, so execute all of them listed in:
http://wiki.processmaker.com/3.2/Executing_cron.php

If you are waiting for an email, then after you execute the cron scripts, you should open the case in ProcessMaker and check whether the email is listed under Information > Messages History or you can check in the APP_HISTORY table in the database.
By Processnico
#814319
So if myprocess reminder is running, i should to execute two times timereventcron.php everytime that i start a new process?
Code: Select all
su -s /bin/sh daemon -c "/opt/bitnami/php/bin/php /opt/bitnami/apps/processmaker/htdocs/workflow/engine/bin/timereventcron.php +force"
Is possible to execute timereventcron.php two times a day?

Thanks.
User avatar
By amosbatto
#814337
Processnico wrote:So if myprocess reminder is running, i should to execute two times timereventcron.php everytime that i start a new process?
Code: Select all
su -s /bin/sh daemon -c "/opt/bitnami/php/bin/php /opt/bitnami/apps/processmaker/htdocs/workflow/engine/bin/timereventcron.php +force"
Is possible to execute timereventcron.php two times a day?
To properly set the timer in the case, timereventcron.php needs to execute once after the case has reached the timer in the process to set the time when the timer should end. Then it needs to run additional times to check if the timer has finished.

You need to follow these instructions to set a cron job in your server to periodically execute timereventcron.php. For example, if you only want it to execute twice per day:
Code: Select all
crontab -u daemon -e
Code: Select all
* */12 * * *   /opt/bitnami/php/bin/php -f /opt/bitnami/apps/processmaker/htdocs/workflow/engine/bin/timereventcron.php +force
You probably want it to execute more than twice per day, since that means a full day for the timer to finish.
By Processnico
#814356
When i open crontab i should to put this command?
Code: Select all
* */12 * * *   /opt/bitnami/php/bin/php -f /opt/bitnami/apps/processmaker/htdocs/workflow/engine/bin/timereventcron.php +force
After this how i execute crontab? or is automatic the execution?

I put crontab -l , the output is.
Code: Select all
*/15 * * * * su daemon -s /bin/sh -c "/opt/bitnami/php/bin/php -f /opt/bitnami/apps/processmaker/htdocs/workflow/engine/bin/cron.php +force" #processmaker-cron
User avatar
By amosbatto
#814364
Read the documentation:
http://wiki.processmaker.com/3.2/Execut ... nux.2FUNIX

After you issue the crontab -u daemon -e command, the default text editor will open for your distribution. Then, edit the file so it looks like this:
Code: Select all
* */12 * * *   /opt/bitnami/php/bin/php -f /opt/bitnami/apps/processmaker/htdocs/workflow/engine/bin/timereventcron.php +force
Save the file. Then, the execution should be automatic after that.

Capture.PNG I have use this javascript code to ad[…]

Having a business, especially when it involves tra[…]

The condition is not workable

Hi there, Recently I've encountered the amount wh[…]

Yes i'm using vue js to load the data.