Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
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.
#827200
I have a strange problem:

Script tasks with triggers with external executeQuery do not work. I have script tasks with a trigger that connects with an external database and it doesn't work outside an esuary task like a step before or after a dynaform for example. Here's a piece of the trigger:

$ db = "5762336645d2a0ff2cf1439019917712";
$ sql = "SELECT TYPE CALL AS IDCHAMED, MONTH, YEAR, USERID, USER, COUNT (*) AS QTY FROM U_CALLSWEB WHERE MES = '$ mes' AND YEAR =' $ year 'AND SITUATION =' CLOSED 'AND TYPE CALL =' 6 - PERSONAL VISIT 'GROUP BY TIPOCHAMADO, MONTH, YEAR, USERID, USER ORDER BY USERID ASC ";
$ res = executeQuery ($ sql, $ db);

The strange thing is that this same trigger works normal on a user task as a step, and doesn't work on a script task ...

What can it be? Is it about permissions? User login?

Using PM V3.3.10.
#827203
Hi,

Please check your trigger again:
Code: Select all
$mes = 'YOUR_MES';
$year = 'YOUR_YEAR';
$db = "5762336645d2a0ff2cf1439019917712";
$sql = "
	SELECT TYPE CALL AS IDCHAMED, MONTH, YEAR, USERID, USER, COUNT(*) AS QTY 
	FROM U_CALLSWEB 
	WHERE MES = '$mes' AND YEAR ='$year' AND SITUATION = 'CLOSED' AND 
	TYPE CALL ='6 - PERSONAL VISIT'
	GROUP BY TIPOCHAMADO, MONTH, YEAR, USERID, USER 
	ORDER BY USERID ASC
";
$res = executeQuery($sql, $db);
If you have error with script task, you can set your trigger on your main task on after routing event.

https://pmlearning.info
Thanks
Last edited by programerboy on Wed Apr 07, 2021 1:13 am, edited 1 time in total.
#827506
hi,
i have the same problem as you've posted...do you have found the answer??
i know that the resason is that executeQuery is for pmFunctions class and i have tried to include pmFunctions in my external script but still it can not fined executeQuery() in pm from external script...
i will appreciate your help...
#827508
https://forum.processmaker.com/viewtopic.php?f=44&t=737122
the latest post on this topic is the solution, and you can use it to call external script contained executeQuery usages from a trigger...
but my problem is that when I want to run the same external script from another place, not in triggers (i mean when you want to run the external script from another external script not from triggers) I have another error which throws from pmFunctions class on executeQuery() function which says :
PHP Fatal error: Uncaught Error: Call to undefined function config() in C:\Bitnami\processmaker-3.3.2-0\apps\processmaker\htdocs\workflow\engine\classes\class.pmFunctions.php:244
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[…]