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.
Hi folks,

I have process which allows the user to upload a spreadsheet using a File control which then, at a later task, populates a grid. This works fine when the process is initiated from New Cases.

However, if I initiate this from a Web Entry the file appears to upload correctly (it appears on the Dynaform and if you click on the link it downloads correctly) but the grid is empty and an error is generated in debug Error loading Document /0. This row doesn't exist! which makes sense because there is nothing in the Input Documents.

I'm using the same code in both instances - is there something special I have to do for the web entry?

I have attached the process and the spreadsheet.

I am using Community 3.2.1

thanks as always
(271.64 KiB) Downloaded 54 times
Spreadsheet used to populate grid
(38.31 KiB) Downloaded 24 times
The problem is that Web Entry is not setting the @@printSerialsRecord variable, so you are going to have to lookup the ID of the file in the APP_DOCUMENT table. Change this:
Code: Select all
$fileId = json_decode(@@printSerialsRecord)[0];
Code: Select all
if (!empty(@@printSerialsRecord)) {
   $fileId = json_decode(@@printSerialsRecord)[0];
else {
      AND APP_DOC_FIELDNAME='printSerialsRecord'";
   $result = executeQuery($sql);
   if (empty($result)) {
       throw new Exception("No uploaded file for this case.");
   $fileId = $result[1]['APP_DOC_UID']; 
Hi Amos,

I tried that code but I now debug gives me the error"

Could not open /opt/processmaker/shared/sites/workflow/files/988/729/474/5b70c10c27d2b5028035781/2530427255b70c10d197097058515343_1. for reading! File does not exist.

There is still no document in Information/Uploaded documents. However when I run the SQL query you included in the code above I do get an appropriate result with the correct file names in APP_DOC_FILENAME and APP_DOC_TITLE (see attached CSV).

Thanks for your time. I appreciate your help very much.

(678 Bytes) Downloaded 22 times
Based on your database record, the correct path to the file should be:

It looks like the code is not able to get the correct file extension.
To verify that this is the problem, change the "Upload Print Serial Record" trigger from:
Code: Select all
   $ext = pathinfo($filename, PATHINFO_EXTENSION);
Code: Select all
   $ext = pathinfo($filename, PATHINFO_EXTENSION); 
   @@ext = $ext;
And then check whether the "ext" variable is set to "xlsx" in the debugger when running a case.

Maybe pathinfo() can't handle your filename. Try uploading a file with a simpler filename (like "mysheet.xlsx") and see if you get the same problem.

Also, you should change from PhpExcel to PhpSpreadsheet. See: ... preadsheet

Hi everyone! I am trying to create a link to a ex[…]

Routing Rule

Could you please share a screenshot from your proc[…]


I didn't work on this version of PM but I could su[…]

radio has a data automatic

Make sure you have assigned a variable to the radi[…]