Questions and discussion about using ProcessMaker: user interface, running cases & functionality

Moderator: amosbatto

#787526
If you are using an external database, you have to create a database connection to the database you are using and if you use a PM table to store the data, you do not need a database connection. Using the Dynaform, data will be inserted into the DB.


Vladimir Vargas
Quality Engineer
ProcessMaker
#825510
Hi All,

I make a trigger to input from dynaform to PM Tables.
at my community edition, it works perfectly.
but, when I import it to my enterprise edition, it did not work.
can anyone help? is any other permission I had to set? where can I found the error log? please help
#825546
rachmadiniutami wrote: Sun Jul 21, 2019 11:47 pm I make a trigger to input from dynaform to PM Tables.
at my community edition, it works perfectly.
but, when I import it to my enterprise edition, it did not work.
can anyone help? is any other permission I had to set? where can I found the error log? please help
In Debug Mode, do you see an "__ERROR__" variable?

In your env.ini file, you can set:
debug = 1

If that doesn't show you anything, then delete debug = 1 and set:
debug_sql = 1

If that doesn't show you anything, then see your MySQL logs:
https://stackoverflow.com/questions/544 ... s-in-mysql
#825911
rachmadiniutami wrote: Tue Aug 06, 2019 4:12 am Now I am facing new problem.
it seems like in version 3.3 enterprise, the hidden field can't hold array anymore.
bacause, when I chooce variable for hidden filed, it doesn't available
If you want to store an array in a hidden field, you need to convert it to a JSON string like this in JavaScript:
Code: Select all
var a = ["some", "thing"];
var s = JSON.stringify(a);
$("#myHidden").setValue(s);
Then to convert it back to an array do this:
Code: Select all
var a = JSON.parse( $("#myHidden").getValue() );
To do the same with PHP, use json_encode() and json_decode().
#825923
thank you @amosbatto, I finally show the data to Grid than panel.
and its good too.
but, thanks for the support.

Now I had new problem,
I need to send input docs as an attachment email which is send right after a case is submitted.
I follow the way in the link below, part "Send Input Docs File as email attachments", then run the cron job.
the cron message is sucessfull but no email receive in the email inbox.

what should I do?
#825924
rachmadiniutami wrote: Sun Aug 11, 2019 9:32 pm thank you @amosbatto, I finally show the data to Grid than panel.
and its good too.
but, thanks for the support.

Now I had new problem,
I need to send input docs as an attachment email which is send right after a case is submitted.
I follow the way in the link below, part "Send Input Docs File as email attachments", then run the cron job.
the cron message is sucessfull but no email receive in the email inbox.

what should I do?

forgot the link
https://wiki.processmaker.com/3.0/Input_Documents
#825936
Does the trigger code work if you execute it inside the ProcessMaker interface (not as part of a cron job)?

Change your code from:
Code: Select all
   PMFSendMessage($caseId, '[email protected]', $to, '', '',
      'Invoices for case #'[email protected]@APP_NUMBER, 'invoiceTemplate.html', array(), $aAttached);
}
To:
Code: Select all
   @=files = $aFiles;  
   @=attachments = $aAttached;
   PMFSendMessage($caseId, '[email protected]', $to, '', '',
      'Invoices for case #'[email protected]@APP_NUMBER, 'invoiceTemplate.html', array(), $aAttached);
}
Then open the case with Debug Mode enabled, and see what is the value of the "files" and "attachments" variables.

Then check whether you can find the files in the APP_DOCUMENT table and the files in the ProcessMaker server's file system.
#825939
How to execute the trigger without run a cron job?

I put the trigger attached to fire after routing, but no email receive from PM on my Inbox.
then I run cron job, but still no email receive.

$inputDocId = '7416973405d1425b7e84206068536329'; //set to Input Document ID
$caseId = @@APPLICATION;
//find the UID and version for the uploaded Input Document file(s):
$query = "SELECT APP_DOC_UID, DOC_VERSION FROM APP_DOCUMENT
WHERE APP_UID='$caseId' AND DOC_UID='$inputDocId' AND
APP_DOC_STATUS='ACTIVE' ORDER BY APP_DOC_INDEX";
$aFiles = executeQuery($query);

if (is_array($aFiles) and count($aFiles) > 0) {
$aAttached = array();

foreach ($aFiles as $aFile) {
$d = new AppDocument();
$aDoc = $d->Load($aFile['APP_DOC_UID'], $aFile['DOC_VERSION']);
$filename = $aDoc['APP_DOC_FILENAME'];
$ext = pathinfo($filename, PATHINFO_EXTENSION);
$g = new G();
$filePath = PATH_DOCUMENT . $g->getPathFromUID($caseId) . PATH_SEP .
$aFile['APP_DOC_UID'] .'_'. $aFile['DOC_VERSION'] .'.'. $ext;
$aAttached = PMFAddAttachmentToArray($aAttached, $filename, $filePath);
}
@=files = $aFiles;
@=attachments = $aAttached;
PMFSendMessage($caseId, '[email protected]', '[email protected]', '', '', 'Invoices for case #'[email protected]@APP_NUMBER, 'SendMemo.html', array(), $aAttached);
}

kindly find attached the debug result.
value of file and attachment is null, but I can find the files at server file system
Attachments
debug.JPG
debug.JPG (33.86 KiB) Viewed 441 times
#825962
rachmadiniutami wrote: Mon Aug 12, 2019 10:21 pm How to execute the trigger without run a cron job?
Start the case inside the ProcessMaker interface and execute the trigger inside the ProcessMaker interface, so you can check the debugger to see the value of your case variables. Sometimes triggers execute differently in the ProcessMaker interface than as a cron job.

Do you see the __ERROR__ variable in the debugger?

Change from:
$aFiles = executeQuery($query);

To:
$aFiles = executeQuery($query);
print "<pre>"; var_dump($query); var_dump($aFiles); die;


Then execute the trigger in the ProcessMaker interface and do you see anything in the $aFiles variable?
If not, then you probably need to change your $inputDocId to the ID of your Input Document. Execute the SQL query directly in MySQL (you can use PhpMyAdmin) to verify whether the SQL query is good.

If you still can't figure it out, then export your process and post your .pmx file.
#825994
The problem is that you didn't associate the Input Document "memo" with the Multiple File field:
AssociatedInputDocumentWithFileField.png
AssociatedInputDocumentWithFileField.png (28.98 KiB) Viewed 415 times
Note: if you are using an older version of ProcessMaker that doesn't allow you to associate the Input Document with a MultipleFile field, then you need to remove the Input Document ID from the SQL query in the trigger. If your case has multiple File fields, and you only want to find files from that particular field, you can instead search for the APP_DOC_FIELDNAME:
Code: Select all
$query = "SELECT APP_DOC_UID, DOC_VERSION FROM APP_DOCUMENT
   WHERE APP_UID='$caseId' AND APP_DOC_FIELDNAME='inputDok' AND
   APP_DOC_STATUS='ACTIVE' ORDER BY APP_DOC_INDEX";
#826160
Vvladimir wrote: Mon Nov 21, 2016 4:11 pm If you are using an external database, you have to create a database connection to the database you are using and if you use a PM table to store the data, you do not need a database connection Box à Louer. Using the Dynaform, data will be inserted into the DB.


Vladimir Vargas
Quality Engineer
ProcessMaker
Thank you very much for sharing all this information with us.
pdf preview in processmker

Hi, You must create a panel in your form, then cre[…]

claim multiple unassigned case

Hi, I have created "User Friendly Panel"[…]

Stop download file on click of link

Hi, You can this link for get download url: https[…]

i want to check the checkbox on certain condition.[…]