Questions and discussion about using ProcessMaker: user interface, running cases & functionality
#798826
Good afternoon,


I am using "web-entry" form and "action by email" function with processmaker.

I was wondering is it possible to generate an output document and save it into a specific location on my server after submitting a web-entry form.

Is this achievable?


Many thanks,
Yuan
#798844
Yuan,
Edit the code of the generated file for your web entry:
{INSTALL-DIRECTORY}/processmaker/shared/sites/{WORKSPACE}/public/{PROCESS-UID}/{STEP-UID}Post.php

Change lines 156-7 from:
Code: Select all
        $aMessage["MESSAGE"] = "<br />Case created in ProcessMaker<br />Case Number: $caseNr <br />Case Id: $caseId<br />Case derivated to: $assign";
    } else {
To:
Code: Select all
        $aMessage["MESSAGE"] = "<br />Case created in ProcessMaker<br />Case Number: $caseNr <br />Case Id: $caseId<br />Case derivated to: $assign";
        
        try{
           $g = new \G();
           $g->LoadClass("pmFunctions");
           $outDocId = '8026916775a1782551ba405093098157'; //set to ID of Output Document
           $destinationDir = '/tmp/';  //set to path where copying the file
           PMFGenerateOutputDocument($outDocId, $caseId, 1, $USR_UID);
           $sql = "SELECT * FROM APP_DOCUMENT WHERE APP_UID='$caseId' AND DOC_UID='$outDocId'";
           $aDoc = executeQuery($sql);
           
           $fileId    = $aDoc[1]['APP_DOC_UID'];
           $versionNo = $aDoc[1]['DOC_VERSION'];
           $filename  = $aDoc[1]['APP_DOC_FILENAME']; 
           $origName  = $fileId . '_' . $versionNo . '.pdf';
           $outDocPath = PATH_DOCUMENT . $g->getPathFromUID($caseId) . PATH_SEP . "outdocs" . PATH_SEP . $origName;
           if (file_exists($destinationDir.$filename.'.pdf')) {
               $filename = $filename . date('_Y-m-d_H-i-s');
           }
           copy($outDocPath, $destinationDir.$filename.'.pdf');
        }
        catch(Exception $e) {
           die($e->getMessage());
        }    
    } else {
Note: This file will be regenerated every time you save the Web Entry properties, so you will loose your code changes if you change the web Entry.
#798845
Thank you very much for the detailed solution!

By the way, I have a super long form at the moment, I was wondering is it possible to separate it into many parts?
123.PNG
123.PNG (51.95 KiB) Viewed 6651 times
Please see attached image, for example, if I have three sections, when the user finish section one, he click the "Next Step", then the form will redirect to the section two, and then goes on.

Is this possible to do that? Or any work around ideas?

Thanks,

Yuan
#798862
amosbatto wrote:You could use jQuery's hide() and show() methods to show parts of the form when the user clicks on each tab.
Thank you very much for your answer it works!

By the way,
To display the loading spinning circles in your DynaForm, you can use this code:
$("body").append("<div class='pmDynaformLoading'></div>");

And to remove them, you can use this code:
$("body").find("div.pmDynaformLoading").remove();
I have tried these code but nothing happened. Could you please provide an example?

Thanks,
yuan
#798872
cosyxu wrote:
amosbatto wrote:You could use jQuery's hide() and show() methods to show parts of the form when the user clicks on each tab.
Thank you very much for your answer it works!

By the way,
To display the loading spinning circles in your DynaForm, you can use this code:
$("body").append("<div class='pmDynaformLoading'></div>");

And to remove them, you can use this code:
$("body").find("div.pmDynaformLoading").remove();

I have tried the following code it works,

$("#1197621835a1c8f9630a320061957706").showFormModal();
$("#1197621835a1c8f9630a320061957706").hideFormModal();

but how should I do to perform the following function?

Since I have a long grid to display after clicking this button, it takes 5-6 seconds, during this period I want to show modal image instead of a freezing page. When the gird has completed loading, then this modal will disappear. Is this possible? Or any work around methods?

Please see sample image.
1.jpg
1.jpg (217.23 KiB) Viewed 6595 times

Thanks,
Yuan
#804965
cosyxu wrote:
amosbatto wrote:To display the loading spinning circles in your DynaForm, you can use this code:
$("body").append("<div class='pmDynaformLoading'></div>");

And to remove them, you can use this code:
$("body").find("div.pmDynaformLoading").remove();
I have tried these code but nothing happened. Could you please provide an example?
Here is a sample DynaForm with the spinning circles:
(627 Bytes) Downloaded 292 times
cosyxu wrote:Since I have a long grid to display after clicking this button, it takes 5-6 seconds, during this period I want to show modal image instead of a freezing page. When the gird has completed loading, then this modal will disappear. Is this possible? Or any work around methods?
Are you using REST calls to populate the grid?

You can do something like:
Code: Select all
function populateGrid() {
   //start getting info to populate grid:
   $("body").append("<div class='pmDynaformLoading'></div>");
  
   //call REST to get data for the grid
   //fill grid with grid.addRow()

   //done populating the grid:
   $("body").find("div.pmDynaformLoading").remove();
}
#810675
amosbatto wrote:
cosyxu wrote:
amosbatto wrote:To display the loading spinning circles in your DynaForm, you can use this code:
$("body").append("<div class='pmDynaformLoading'></div>");

And to remove them, you can use this code:
$("body").find("div.pmDynaformLoading").remove();
I have tried these code but nothing happened. Could you please provide an example?
Here is a sample DynaForm with the spinning circles:
loading circles.json
cosyxu wrote:Since I have a long grid to display after clicking this button, it takes 5-6 seconds, during this period I want to show modal image instead of a freezing page. When the gird has completed loading, then this modal will disappear. Is this possible? Or any work around methods?
Are you using REST calls to populate the grid?

You can do something like:
Code: Select all
function populateGrid() {
   //start getting info to populate grid:
   $("body").append("<div class='pmDynaformLoading'></div>");
  
   //call REST to get data for the grid
   //fill grid with grid.addRow()

   //done populating the grid:
   $("body").find("div.pmDynaformLoading").remove();
}
Thanks for the solution.

It works. :D
#824299
amosbatto wrote: Fri Nov 24, 2017 12:30 am Yuan,
Edit the code of the generated file for your web entry:
{INSTALL-DIRECTORY}/processmaker/shared/sites/{WORKSPACE}/public/{PROCESS-UID}/{STEP-UID}Post.php

Change lines 156-7 from:
Code: Select all
        $aMessage["MESSAGE"] = "<br />Case created in ProcessMaker<br />Case Number: $caseNr <br />Case Id: $caseId<br />Case derivated to: $assign";
    } else {
To:
Code: Select all
        $aMessage["MESSAGE"] = "<br />Case created in ProcessMaker<br />Case Number: $caseNr <br />Case Id: $caseId<br />Case derivated to: $assign";
        
        try{
           $g = new \G();
           $g->LoadClass("pmFunctions");
           $outDocId = '8026916775a1782551ba405093098157'; //set to ID of Output Document
           $destinationDir = '/tmp/';  //set to path where copying the file
           PMFGenerateOutputDocument($outDocId, $caseId, 1, $USR_UID);
           $sql = "SELECT * FROM APP_DOCUMENT WHERE APP_UID='$caseId' AND DOC_UID='$outDocId'";
           $aDoc = executeQuery($sql);
           
           $fileId    = $aDoc[1]['APP_DOC_UID'];
           $versionNo = $aDoc[1]['DOC_VERSION'];
           $filename  = $aDoc[1]['APP_DOC_FILENAME']; 
           $origName  = $fileId . '_' . $versionNo . '.pdf';
           $outDocPath = PATH_DOCUMENT . $g->getPathFromUID($caseId) . PATH_SEP . "outdocs" . PATH_SEP . $origName;
           if (file_exists($destinationDir.$filename.'.pdf')) {
               $filename = $filename . date('_Y-m-d_H-i-s');
           }
           copy($outDocPath, $destinationDir.$filename.'.pdf');
        }
        catch(Exception $e) {
           die($e->getMessage());
        }    
    } else {
Note: This file will be regenerated every time you save the Web Entry properties, so you will loose your code changes if you change the web Entry.
Hi Amo,

Long time ago, you mentioned that it is possible to copy attachments and save to a different location by using the above method.

However I want to know if it is possible to add the above code as a script task inside a process, so at the end of the process, all the attachments will be saved to a specific place.

Could you please let me know if this is possible? The specific address i want to copy to is one of our shared drive(h:/documents/year/@@process_name/@@caseid/save_everything_under_here).

Thanks,
Yuan
#824325
cosyxu wrote:However I want to know if it is possible to add the above code as a script task inside a process, so at the end of the process, all the attachments will be saved to a specific place.

Could you please let me know if this is possible? The specific address i want to copy to is one of our shared drive(h:/documents/year/@@process_name/@@caseid/save_everything_under_here).
I wrote up an example trigger to handle this:
https://www.pmusers.com/index.php/Copy_ ... _directory

A 1xbet clone script is a pre-designed software so[…]

4rabet clone script is enabling entrepreneurs to e[…]

Parimatch clone script is enabling entrepreneurs t[…]

In the world of cryptocurrency, a wallet is an app[…]