One of the questions we at the Processmaker Support Team usually get either in the Forums or at the Bug Tracking site, is related to inserting a link to an uploaded document in a Dynaform, so further users down the process can click on this link in order to download/open the document right on their browsers, like this:
First, we need to create this trigger:
$caseId = @@APPLICATION;
$result = executeQuery("SELECT APP_DOC_UID FROM APP_DOCUMENT WHERE APP_UID='$caseId'");
@@myVar = $result;
$res = @@myVar;
@@text_hidden = "click here to download document";
@@address_hidden = $dir;
This trigger has to be run before the Dynaform where we want the link inserted, is displayed to the user.
Now we need to create 2 hidden fields at the beginning of this Dynaform, called
getField("link").href = getField("address_hidden").value;
getField("link").innerHTML = getField("text_hidden").value;
…and finally, a link field where we’re going to insert the actual link to the uploaded Input Document, called
The neat thing about this, is that you can use this link for Input Documents uploaded either by use of an Input Document step in a task (using the standard Input Document form) or a File field inside a Dynaform.