Share ideas, ask questions, and get feedback about developing for ProcessMaker
Forum rules: Please post new questions under "Developing processes & programming" for ProcessMaker 2 or 3.
By Anuradha
#786551
Hello all,
We are creating process where data has to save in custom tables.So how can we get last inserted id of 1st insert query ,and insert it in 2nd insert query in 2nd table. How it is possible using executeQuery() of processmake. Can we use mysqli_connect(), mysqli_query() and mysqli_insert_id() in trigger.
User avatar
By amosbatto
#786555
If your tables are PM tables then use executeQuery(). See examples in the wiki. If tables are in an external database, then Create a database connection to the database holding the table. Then add a trigger which calls executeQuery() and use the ID of the database connection as the second parameter in the function.
By chieunh
#789399
you can use mysqli_connect(), mysqli_query() and mysqli_insert_id() in trigger.
Ex:
$con=mysqli_connect($host,$user,$passwd,$dbname);
// Check connection
if (mysqli_connect_errno())
{
die("Failed to connect to MySQL: " . mysqli_connect_error());
}
...
$sqlQuery = "......";
if(!mysqli_query($con,$sqlQuery )){
die("Error xxx");
}
mysqli_close($con);


$appID = @@APPLICATION;
$appNumber = @@APP_NUMBER;

In your custom tables, you should use appID or appNumber is primary key.
User avatar
By mk8800
#790117
it's too late and it's a ugly way but this is my way:
Code: Select all
$insertCount= executeQuery("INSERT INTO mytable (column) values('value')");
$result = executeQuery("select LAST_INSERT_ID() L");
$newId=($result[1]['L']);
And Closa Please improve data model and add features like this, you are so far behind from common php frameworks.

A 1xbet clone script is a pre-designed software so[…]

4rabet clone script is enabling entrepreneurs to e[…]

Parimatch clone script is enabling entrepreneurs t[…]

In the world of cryptocurrency, a wallet is an app[…]