Questions and discussion about using ProcessMaker 2: user interface, running cases and functionality
Forum rules: Please search to see if a question has already been asked before posting. Please don't ask the same question in multiple forums.
By reneincer
#11297
Hi there,

Is any way to share uploaded documents in a Master Process task with Subprocess?
I have to make visible uploaded files to subprocess tasks and users, like when you share variables,

Any idea?

Thks,
#11305
I solved my case,
I did a trigger in before open the case in the subprocess that copy all the files from the Parent Case to a new folder with files,

The idea is to pass the parente TaskUID to the childs subprocesses, and then, in the subprocess, select all documents from parents and with loop, generate the files and insert in the tables about document information,
Code: Select all
//@@AppIDPadre
//6763916014d630cbbb81e26092883104

if(!isset(@@txtAbierto))
{

$appidpadre = @@AppIDPadre;
$appidnuevo = @@APPLICATION;
//$appidnuevo = G::generateUniqueID();
//$gerenteUID = G::generateUniqueID();

$resultdocs = executeQuery("select * from app_document where app_uid = '$appidpadre'");

$iRowD = count($resultdocs);
mkdir('c:/Program Files/ProcessMaker/processmaker/shared/sites/workflow/files/'.$appidnuevo, 0777, true);
for ($j = 1; $j <= $iRowD; $j++) {
	$docid = $resultdocs[$j]['APP_DOC_UID'];
	$resultdetalledoc = executeQuery("select con_value archivo, substring(con_value, length(con_value) - locate('.',reverse(con_value)) + 2 ,
		  locate('.',reverse(con_value)) - 1 ) extension	
		  From content where con_id = '$docid' and con_category = 'APP_DOC_FILENAME' limit 1");
	$nombrearchivo = $resultdetalledoc[1]['archivo'];
	$extension = $resultdetalledoc[1]['extension'];
	$docidnuevo = G::generateUniqueID();
	
	$resultusuario = executeQuery("select usr_uid from app_delegation where app_uid = '$appidnuevo' limit 1") ;
	$gerenteUID = $resultusuario[1]['usr_uid'];
	
	$source = 'c:/Program Files/ProcessMaker/processmaker/shared/sites/workflow/files/'.$appidpadre.'/'.$docid.'_1.'.$extension;
	$destination = 'c:/Program Files/ProcessMaker/processmaker/shared/sites/workflow/files/'.$appidnuevo.'/'.$docidnuevo.'_1.'.$extension;
	//print $source;
	//print $destination;
	copy($source, $destination) ;

	@@RESULT = executeQuery("INSERT INTO CONTENT
		SELECT 'APP_DOC_TITLE','1','$docidnuevo','es',''
		UNION
		SELECT 'APP_DOC_COMMENT','1','$docidnuevo','es',''
		UNION
		SELECT 'APP_DOC_FILENAME','1','$docidnuevo','es','$nombrearchivo'
		UNION
		SELECT 'APP_DOC_TITLE','','$docidnuevo','es',''
		UNION
		SELECT 'APP_DOC_COMMENT','','$docidnuevo','es',''");    
	@@RESULT = executeQuery("INSERT INTO app_document
		SELECT '$docidnuevo',1,'$appidnuevo',$j, 'iddocumento', '$gerenteUID', 'INPUT', now(), $j,'','','INPUT','ACTIVE', Null ");

}
	
}
Did I forget something, or some table?

I have a question, i am not filling the field DOC_UID, what do this supposed to be? What is the difference between APP_DOC_UID and DOC_UID?
#784399
Hi Reneincer,

Thanks for your great idea.

As far as my understanding, APP_DOC_UID is an ID for every document uploaded. It spesific for every document.
And DOC_UID is an ID for INPUT_DOCUMENT we create. And some APP_DOC_UID may have same DOC_UID if uploaded from same INPUT_DOCUMENT.

Thx
Want to create your own meme coin?

In the world of cryptocurrencies, a unique and exc[…]

The market for cryptocurrencies is demonstrating a[…]

What's SAP FICO?

Embarking on a dissertation can be one of the most[…]

Hello. For rental housing, there are software solu[…]