Questions and discussion about using ProcessMaker: user interface, running cases & functionality
#822021
hi all,

i am using on a process which is a support process. some of our employee have a lot of case. so i want to help them which case they need to work. so that i create a process which have only one task. they chosee some data and collect datas which include what they need. i stored their case number and i know their APP_TAS_TITLE , using that information i want to create a link for each case. there is my trigger
Code: Select all
if (@@action == 'search') {
	@@action = '';
	$where = '';
	if (@@tedarikci) { 
		$where .= "TEDARIKCI='".@@tedarikci."'";
	}	
	if (@@karegori) {
		$where .= (empty($where) ? '' : ' AND ') . 
			"TALEPKAT='".@@karegori."'";
	}	
	if (@@grup) {
		$where .= (empty($where) ? '' : ' AND ') .
			"TALEPGRUP='".@@grup."'";
	}
    
	$where = (empty($where) ? '' : 'WHERE ') . $where;
	
	$sql = "SELECT CASENO as satinalma01,CONCAT(TALEPKAT,' ',TALEPGRUP,' ',TALEPURUN,' ',TALEPBOYAMA) as satinalma02, CONCAT(TALEPMIKTAR,' ',TALEPADET) as satinalma03,CONCAT(GELENMIKTAR,' ',GELENADET) as satinalma04 from PMT_SATINALMA $where  AND SADURUM!='2' ORDER BY TALEPURUN,TALEPBOYAMA";
		
	@=satinalma = executeQuery($sql);
	
	

for ($k = 1; $k <= count(@=satinalma); $k++) {
    $CASENO = @=satinalma[$k]['satinalma01'];
    $sql1 = "SELECT APP_UID, DEL_INDEX  FROM APP_CACHE_VIEW WHERE APP_NUMBER = '$CASENO' AND APP_TAS_TITLE = 'Siparişlerin Mal Kabule İletilmesi'";
	$aRows1 = executeQuery($sql1);
	$url = "../cases/open?APP_UID=".$aRows1['APP_UID']."&DEL_INDEX=".
			$aRows1['DEL_INDEX']."&action=draft";
     @=satinalma[$k]['url'] = $aRows1[1]['url'];
};
	
	PMFRedirectToStep(@@APPLICATION, @%INDEX, 'DYNAFORM', '6509094235c1239d20df525098306517');
}
i have failed hard i think
Ekran Alıntısı.PNG
Ekran Alıntısı.PNG (162.06 KiB) Viewed 4056 times
can you help me with create a link ?
#822024
I see one problem with your trigger. If the user doesn't enter anything in the search fields your SQL query will have:
WHERE AND SADURUM!='2'

To prevent this problem, use this code:
Code: Select all
	$where = 'WHERE ' . $where . ($where ? ' AND' : '') . " SADURUM!='2'";
	
	$sql = "SELECT CASENO as satinalma01, CONCAT(TALEPKAT,' ',TALEPGRUP,' ',TALEPURUN,' ',TALEPBOYAMA) as satinalma02, CONCAT(TALEPMIKTAR,' ',TALEPADET) as satinalma03,  CONCAT(GELENMIKTAR,' ',GELENADET) as satinalma04 from PMT_SATINALMA $where ORDER BY TALEPURUN,TALEPBOYAMA";
I assume that the first column in your grid is a link field whose ID is "url", but you can't set links that way in ProcessMaker. You need to use JavaScript to set the URL in a link field. Change the ID of your link field in the grid to "caseLink". Then add a hidden field to your grid whose ID is "url".

Then, add the following JavaScript to your Dynaform to set the links when the Dynaform loads:
Code: Select all
var gridId = "my_grid_id"; //set to the ID of the grid
var linkId = "my_link_id"; //set to ID of the link field in the grid
var urlColumnNo = 4;  //set to the column number of the "url" hidden field in the grid 
var nRows = $("#"+gridId).getNumberRows();

for (var i = 1; i <= nRows; i++) {
     var oLink = $("#form\\["+gridId+"\\]\\["+i+"\\]\\["+linkId+"\\]");
     oLink.prop("href", $("#"+gridId).getValue(i, urlColumnNo));
     oLink.prop("target", "");
     //if you want to set a custom label for the link:
     //oLink.html("my link label");
}
#822030
amosbatto wrote: Thu Dec 13, 2018 11:19 pm I see one problem with your trigger. If the user doesn't enter anything in the search fields your SQL query will have:
WHERE AND SADURUM!='2'

To prevent this problem, use this code:
Code: Select all
	$where = 'WHERE ' . $where . ($where ? ' AND' : '') . " SADURUM!='2'";
	
	$sql = "SELECT CASENO as satinalma01, CONCAT(TALEPKAT,' ',TALEPGRUP,' ',TALEPURUN,' ',TALEPBOYAMA) as satinalma02, CONCAT(TALEPMIKTAR,' ',TALEPADET) as satinalma03,  CONCAT(GELENMIKTAR,' ',GELENADET) as satinalma04 from PMT_SATINALMA $where ORDER BY TALEPURUN,TALEPBOYAMA";
I assume that the first column in your grid is a link field whose ID is "url", but you can't set links that way in ProcessMaker. You need to use JavaScript to set the URL in a link field. Change the ID of your link field in the grid to "caseLink". Then add a hidden field to your grid whose ID is "url".

Then, add the following JavaScript to your Dynaform to set the links when the Dynaform loads:
Code: Select all
var gridId = "my_grid_id"; //set to the ID of the grid
var linkId = "my_link_id"; //set to ID of the link field in the grid
var urlColumnNo = 4;  //set to the column number of the "url" hidden field in the grid 
var nRows = $("#"+gridId).getNumberRows();

for (var i = 1; i <= nRows; i++) {
     var oLink = $("#form\\["+gridId+"\\]\\["+i+"\\]\\["+linkId+"\\]");
     oLink.prop("href", $("#"+gridId).getValue(i, urlColumnNo));
     oLink.prop("target", "");
     //if you want to set a custom label for the link:
     //oLink.html("my link label");
}
ty amos for your helps,

i did what you told me, i got some problem. i think url didnt set correctly. theres is my last trigger
Code: Select all
if (@@action == 'search') {
	@@action = '';
	$where = '';
	if (@@tedarikci) { 
		$where .= "TEDARIKCI='".@@tedarikci."'";
	}	
	if (@@karegori) {
		$where .= (empty($where) ? '' : ' AND ') . 
			"TALEPKAT='".@@karegori."'";
	}	
	if (@@grup) {
		$where .= (empty($where) ? '' : ' AND ') .
			"TALEPGRUP='".@@grup."'";
	}
    
	$where = 'WHERE ' . $where . ($where ? ' AND' : '') . " SADURUM!='2'";
	
	$sql = "SELECT CASENO as satinalma01,CONCAT(TALEPKAT,' ',TALEPGRUP,' ',TALEPURUN,' ',TALEPBOYAMA) as satinalma02, CONCAT(TALEPMIKTAR,' ',TALEPADET) as satinalma03,CONCAT(GELENMIKTAR,' ',GELENADET) as satinalma04 from PMT_SATINALMA $where  ORDER BY TALEPURUN,TALEPBOYAMA";
		
	@=satinalma = executeQuery($sql);
	
	

for ($k = 1; $k <= count(@=satinalma); $k++) {
    $CASENO = @=satinalma[$k]['satinalma01'];
    $sql1 = "SELECT APP_UID, MAX(DEL_INDEX)  FROM APP_CACHE_VIEW WHERE APP_NUMBER = '$CASENO' AND APP_TAS_TITLE = 'Siparişlerin Mal Kabule İletilmesi'";
	$aRows1 = executeQuery($sql1);
	$url = "../cases/open?APP_UID=".$aRows1['APP_UID']."&DEL_INDEX=".
			$aRows1['DEL_INDEX']."&action=draft";
     @=satinalma[$k]['url'] = $url;
};

	
	PMFRedirectToStep(@@APPLICATION, @%INDEX, 'DYNAFORM', '6509094235c1239d20df525098306517');
}
there is error
Ekran Alıntısı.PNG
Ekran Alıntısı.PNG (86.67 KiB) Viewed 4035 times

btw the process i chosee is on my inbox.
i need a way to open the case in new tab. maybe my way is wrong? do you have any idea to open case in new tab? i have only casenumber but i can set USR_UID and APP_TAS_TITLE
#822052
You should only have one case open at a time, so you need to open the case in the same browser tab, which is why I changed the link's target to "".

Try this trigger code:
Code: Select all
	$url = "javascript: top.location.href = 'http://www.example.com/sysworkflow/en/neoclassic/cases/opencase/".
       $aRows1['APP_UID']."';";
#822061
amosbatto wrote: Fri Dec 14, 2018 10:16 pm You should only have one case open at a time, so you need to open the case in the same browser tab, which is why I changed the link's target to "".

Try this trigger code:
Code: Select all
	$url = "javascript: top.location.href = 'http://www.example.com/sysworkflow/en/neoclassic/cases/opencase/".
       $aRows1['APP_UID']."';";

hey amos after some of problem i did a trigger with your guide. i am greatfull to you.
but its not give a services what i wanted.
Code: Select all
if (@@action == 'search') {
	@@action = '';
	$where = '';
	if (@@tedarikci) { 
		$where .= "TEDARIKCI='".@@tedarikci."'";
	}	
	if (@@karegori) {
		$where .= (empty($where) ? '' : ' AND ') . 
			"TALEPKAT='".@@karegori."'";
	}	
	if (@@grup) {
		$where .= (empty($where) ? '' : ' AND ') .
			"TALEPGRUP='".@@grup."'";
	}
    
	$where = 'WHERE ' . $where . ($where ? ' AND' : '') . " SADURUM!='2'";
	
	$sql = "SELECT CASENO as satinalma01 from PMT_SATINALMA $where  ";
		
	@=satinalma = executeQuery($sql);
	
	

for ($j = 1; $j <= count(@=satinalma); $j++) {
    $CASENO = @=satinalma[$j]['satinalma01'];
    $sql2 = "SELECT APP_UID, MAX(DEL_INDEX) FROM APP_CACHE_VIEW WHERE APP_NUMBER = '$CASENO' AND APP_TAS_TITLE = 'Siparişlerin Mal Kabule İletilmesi'  ";
	$aRows2 = executeQuery($sql2);
     $appuid = $aRows2[1]['APP_UID'];
	$url = "javascript: top.location.href = 'http://myip/myworkflow/en/neoclassic/cases/opencase/".
       $appuid."';";
     @=satinalma[$j]['url'] = $url;
};

	
	PMFRedirectToStep(@@APPLICATION, @%INDEX, 'DYNAFORM', '6509094235c1239d20df525098306517');
}
this send me to participated cases, but i want to go my inbox. is it possible?
#822114
If your logged-in user is assigned to the current open task in the case, then it will open in the Inbox to work on the case. If the case has moved to a subsequent task in the case, then it will open in Participated. If the logged in user hasn't ever been assigned to the case and doesn't have process permissions to access the case, then it should display a message about not having permission to open the case.
#822176
amosbatto wrote: Tue Dec 18, 2018 12:15 am If your logged-in user is assigned to the current open task in the case, then it will open in the Inbox to work on the case. If the case has moved to a subsequent task in the case, then it will open in Participated. If the logged in user hasn't ever been assigned to the case and doesn't have process permissions to access the case, then it should display a message about not having permission to open the case.
you have my thanks amos
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[…]