Share ideas, ask questions, and get feedback about developing for ProcessMaker

Moderators: ArturoRobles, ArturoRobles

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.

As of now I'm still having this problem.

Timeout Not Sending Email

I am confused, but I have setup a self-service as[…]

Hello; In a dynaform (for example: called "Gr[…]

issue with processmaker 3.2

Ok thank you but i have more questions For exam[…]