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.
#790787
I have a trigger 'insertData' to execute a MySQL stored procedure 'createData'. I have no problem executing the sp but when I execute a workflow with the trigger, it prompts "Error" instead.

What did I miss?

Table 'TEST1' contains an auto inrement column, 'auto_inc_id'

Trigger 'insertData' code:

$db = "13849224459j2345e6846c20533032345";
$sql = "call createData(102)";
$result = executeQuery($sql, $db) or die ("Error");

MySQL SP 'createData' code:

CREATE PROCEDURE `createData`(
IN
appID int(11)
)
BEGIN
DECLARE newID INT DEFAULT 9999;

INSERT INTO TEST1 (
auto_inc_id
) VALUES (
appID
);
SELECT max(auto_inc_id) INTO newID FROM TEST1 WHERE auto_inc_id = appID;

INSERT INTO TEST2 (
auto_inc_id
) VALUES (
newID
);
END
#790789
Hello,

To execute a procedure from the ProcessMaker trigger, you will have to use the following code:
Code: Select all
$db = "13849224459j2345e6846c20533032345";
@@sql = "CALL createData('55')";	//take these variables as case variables. This will always help in debugging the problem
@@result = mysql_query(@@sql);
This is because the PM trigger will not execute a procedure using the function executeQuery().
To execute a procedure from trigger you will have to use the PHP function mysql_query().
You can check the problem occurring in your code by considering the variables as case variables rather than PHP variables and running the process in debug mode.
If the code works fine, you will get "true" for @@result in debug mode otherwise "false".

Hope this helps

Best Regards

To convert MBOX to PST, start by downloading and i[…]

My Assignment Services stands out as one of the be[…]

Erectile Dysfunction, commonly known as impotence,[…]

Want to create your own meme coin?

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