Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderators: ArturoRobles, ArturoRobles

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.
#828130
hi,

I found something might be interested.
I create this trigger:
Code: Select all
function test_function($USERNAME)
{
	$query = "SELECT USR_UID FROM USERS WHERE USR_USERNAME = '$USERNAME'";
	$res = executeQuery($query);
	@@DeptHeadUID = $res['USR_UID'];
}

function test_function2()
{
	$query = "SELECT USR_UID FROM USERS WHERE USR_USERNAME = 'GianYagami'";
	$res = executeQuery($query);
	@@DeptHeadUID = $res['USR_UID'];
}

function foo(){
	return 2 + 2;
}

foo(); //he's cool

//test_function('GianYagami'); //he's not cool

//test_function2(); //this dude also not cool

//$array = new array("USERNAME" = "31406193");
//test_function3($array); //i forgot to make this one, lol
modify dynaform variable inside of user created function makes the code error, I am using PM 3.3
#828145
Hi,
You must change your codes like this:
Code: Select all
function test_function($USERNAME)
{
	$query = 'SELECT USR_UID FROM USERS WHERE USR_USERNAME = "'.$USERNAME.'"';
	$res = executeQuery($query);
	return $res['USR_UID'];
}

@@DeptHeadUID = test_function('GianYagami');
or 
@@DeptHeadUID = test_function(@@USER_LOGGED);
Please check the following link:
http://pmlearning.info/plugins.php
#828213
programerboy wrote: Wed Jun 24, 2020 2:30 pm Hi,
You must change your codes like this:
Code: Select all
function test_function($USERNAME)
{
	$query = 'SELECT USR_UID FROM USERS WHERE USR_USERNAME = "'.$USERNAME.'"';
	$res = executeQuery($query);
	return $res['USR_UID'];
}

@@DeptHeadUID = test_function('GianYagami');
or 
@@DeptHeadUID = test_function(@@USER_LOGGED);
Please check the following link:
http://pmlearning.info/plugins.php
I already implemented it for different cases,
using return and/or "parameterized" function also makes error.
I think trigger script is implemented as function my processmaker engine so we can not create function unless the function has no parameter and return value, I dunno it just my speculation.

Anyway this topic is already fixed using procedural way instead reusable function (I am not using function anymore)

I have a suggest where user have to select some do[…]

The 500 Internal Server Error is the general catch[…]

Really very nice blog information for this one and[…]

This is a long, lengthy and cumbersome process. T[…]